|
|
|
|
@ -9,8 +9,11 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder; |
|
|
|
|
import com.mojang.brigadier.context.CommandContext; |
|
|
|
|
import io.papermc.paper.command.brigadier.CommandSourceStack; |
|
|
|
|
import io.papermc.paper.command.brigadier.Commands; |
|
|
|
|
import org.bukkit.Bukkit; |
|
|
|
|
import org.bukkit.Location; |
|
|
|
|
import org.bukkit.NamespacedKey; |
|
|
|
|
import org.bukkit.Registry; |
|
|
|
|
import org.bukkit.block.Biome; |
|
|
|
|
import org.bukkit.entity.Player; |
|
|
|
|
import org.bukkit.persistence.PersistentDataContainer; |
|
|
|
|
import org.bukkit.persistence.PersistentDataType; |
|
|
|
|
@ -101,6 +104,15 @@ public class IslandAdminCommand { |
|
|
|
|
})) |
|
|
|
|
.executes(IslandAdminCommand::loadTemplate)); |
|
|
|
|
|
|
|
|
|
LiteralArgumentBuilder<CommandSourceStack> setBiome = Commands.literal("biome") |
|
|
|
|
.then(Commands.argument("biome", StringArgumentType.string()) |
|
|
|
|
.suggests(((context, builder) -> { |
|
|
|
|
Registry<Biome> biomeRegistry = Registry.BIOME; |
|
|
|
|
biomeRegistry.stream().forEach(biome -> builder.suggest(biome.getKey().asString())); |
|
|
|
|
return builder.buildFuture(); |
|
|
|
|
})) |
|
|
|
|
.executes(IslandAdminCommand::setBiome)); |
|
|
|
|
|
|
|
|
|
LiteralArgumentBuilder<CommandSourceStack> template = Commands.literal("template") |
|
|
|
|
.then(Commands.argument("uuid", StringArgumentType.word()) |
|
|
|
|
.suggests((context, builder) -> { |
|
|
|
|
@ -165,7 +177,8 @@ public class IslandAdminCommand { |
|
|
|
|
.then(spawn) |
|
|
|
|
.then(enviroment) |
|
|
|
|
.then(expand) |
|
|
|
|
.then(setDefaultIsland); |
|
|
|
|
.then(setDefaultIsland) |
|
|
|
|
.then(setBiome); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -202,6 +215,16 @@ public class IslandAdminCommand { |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static int setBiome(CommandContext<CommandSourceStack> context) { |
|
|
|
|
if (!(context.getSource().getSender() instanceof Player player)) return 0; |
|
|
|
|
IslandManager islandManager = new IslandManager(); |
|
|
|
|
String uuid = player.getWorld().getName(); |
|
|
|
|
islandManager.changeBiome(context.getArgument("biome", String.class), uuid); |
|
|
|
|
Messages.send(player, "island.set-biome.success"); |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static int teleport(CommandContext<CommandSourceStack> context) { |
|
|
|
|
IslandManager islandManager = new IslandManager(); |
|
|
|
|
|