From 42f0965ecadfd8ea510ecea2687b7ebbc8225508 Mon Sep 17 00:00:00 2001 From: benwoo1110 <30431861+benwoo1110@users.noreply.github.com> Date: Sun, 20 Dec 2020 10:32:44 +0800 Subject: [PATCH] Cleanup to various commands. --- .../MultiverseCore/commands_acf/ConfigCommand.java | 2 +- .../MultiverseCore/commands_acf/CoordCommand.java | 6 +++--- .../MultiverseCore/commands_acf/CreateCommand.java | 1 - .../MultiverseCore/commands_acf/GameRuleCommand.java | 5 +++-- .../MultiverseCore/commands_acf/PurgeCommand.java | 2 +- .../MultiverseCore/commands_acf/SetSpawnCommand.java | 1 - .../commands_helper/MVCommandCompletions.java | 2 +- .../MultiverseCore/commands_helper/MVCommandContexts.java | 2 +- 8 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands_acf/ConfigCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands_acf/ConfigCommand.java index 5f9d43f5..0a560a6c 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands_acf/ConfigCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands_acf/ConfigCommand.java @@ -25,7 +25,7 @@ public class ConfigCommand extends MultiverseCommand { super(plugin); } - @Subcommand("show") + @Subcommand("list") @Description("Show multiverse config values.") public void onShowCommand(@NotNull CommandSender sender) { List configList = new ArrayList<>(); diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands_acf/CoordCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands_acf/CoordCommand.java index 34f10c57..59c84cea 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands_acf/CoordCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands_acf/CoordCommand.java @@ -23,14 +23,14 @@ public class CoordCommand extends MultiverseCommand { super(plugin); } - @Subcommand("coord") + @Subcommand("coord|coordinate") @CommandPermission("multiverse.core.coord.self") @Description("Detailed information on the your where abouts.") public void onOtherCoordCommand(@NotNull Player player) { showCoordInfo(player, player); } - @Subcommand("coord") + @Subcommand("coord|coordinate") @CommandPermission("multiverse.core.coord.other") @Syntax("[player]") @CommandCompletion("@players") @@ -44,7 +44,7 @@ public class CoordCommand extends MultiverseCommand { private void showCoordInfo(@NotNull CommandSender sender, @NotNull Player player) { - //TODO: Should somehow clean this up + //TODO: Possible to move to CommandContext or something? MultiverseWorld world = this.plugin.getMVWorldManager().getMVWorld(player.getWorld()); if (world == null) { this.plugin.showNotMVWorldMessage(sender, player.getWorld().getName()); diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands_acf/CreateCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands_acf/CreateCommand.java index fc5d2460..0b8befed 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands_acf/CreateCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands_acf/CreateCommand.java @@ -29,7 +29,6 @@ public class CreateCommand extends MultiverseCommand { @CommandCompletion(" @environments") @Description("Creates a new world and loads it.") public void onCreateCommand(@NotNull CommandSender sender, - //TODO: Cleanup/fix conditions here @NotNull @Flags("trim") @Conditions("creatableWorldName") String worldName, @NotNull World.Environment environment, @NotNull WorldFlags flags) { diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands_acf/GameRuleCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands_acf/GameRuleCommand.java index 9d0a7fa4..54087b9b 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands_acf/GameRuleCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands_acf/GameRuleCommand.java @@ -16,6 +16,7 @@ import org.bukkit.command.CommandSender; import org.jetbrains.annotations.NotNull; @CommandAlias("mv") +@Subcommand("gamerule") public class GameRuleCommand extends MultiverseCommand { public GameRuleCommand(MultiverseCore plugin) { @@ -23,7 +24,7 @@ public class GameRuleCommand extends MultiverseCommand { } //TODO: Should it be `gamerule list` instead? - @Subcommand("gamerules") + @Subcommand("list") @CommandPermission("multiverse.core.gamerule.list") @Syntax("[world]") @CommandCompletion("@MVWorlds") @@ -51,7 +52,7 @@ public class GameRuleCommand extends MultiverseCommand { } //TODO: Should it be `gamerule set` instead? - @Subcommand("gamerule") + @Subcommand("set") @CommandPermission("multiverse.core.gamerule.set") @Syntax(" [world]") @CommandCompletion("@gameRules") diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands_acf/PurgeCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands_acf/PurgeCommand.java index 09491e8f..44cc7493 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands_acf/PurgeCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands_acf/PurgeCommand.java @@ -27,7 +27,7 @@ public class PurgeCommand extends MultiverseCommand { } @Subcommand("purgeall") - @CommandPermission("multiverse.core.purge") + @CommandPermission("multiverse.core.purge.all") @Syntax("") @CommandCompletion("all|animals|monsters|@livingEntities") @Description("Removed the specified type of mob from all worlds.") diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands_acf/SetSpawnCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands_acf/SetSpawnCommand.java index 99f0ea00..6889d84f 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands_acf/SetSpawnCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands_acf/SetSpawnCommand.java @@ -41,7 +41,6 @@ public class SetSpawnCommand extends MultiverseCommand { } } - public class AliasSetSpawn extends BaseCommand { @CommandAlias("mvsetspawn") diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands_helper/MVCommandCompletions.java b/src/main/java/com/onarandombox/MultiverseCore/commands_helper/MVCommandCompletions.java index 8611d80f..ff4e6872 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands_helper/MVCommandCompletions.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands_helper/MVCommandCompletions.java @@ -35,7 +35,7 @@ public class MVCommandCompletions extends PaperCommandCompletions { registerAsyncCompletion("MVWorlds", this::suggestMVWorlds); registerAsyncCompletion("unloadedWorlds", this::suggestUnloadedWorlds); registerAsyncCompletion("potentialWorlds", this::suggestPotentialWorlds); - registerCompletion("location", this::suggestLocation); + registerAsyncCompletion("location", this::suggestLocation); registerAsyncCompletion("MVConfigs", this::suggestMVConfig); //TODO: Change to static registerStaticCompletion("gameRules", suggestGameRules()); registerStaticCompletion("environments", suggestEnvironments()); diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands_helper/MVCommandContexts.java b/src/main/java/com/onarandombox/MultiverseCore/commands_helper/MVCommandContexts.java index 09c2cfe1..cd6bc3ba 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands_helper/MVCommandContexts.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands_helper/MVCommandContexts.java @@ -137,7 +137,7 @@ public class MVCommandContexts extends PaperCommandContexts { private Player derivePlayer(@NotNull BukkitCommandExecutionContext context) { boolean mustBeSelf = context.hasFlag("onlyself"); String error = (mustBeSelf) - ? "You cannot run this command from console." + ? "You must be a player to run this command." : "You need to specify a player from console."; if (mustBeSelf || !context.hasFlag("other")) {