Cleanup to various commands.

This commit is contained in:
benwoo1110 2020-12-20 10:32:44 +08:00
parent 532469145d
commit 42f0965eca
8 changed files with 10 additions and 11 deletions

View File

@ -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<String> configList = new ArrayList<>();

View File

@ -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());

View File

@ -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) {

View File

@ -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("<rule> <value> [world]")
@CommandCompletion("@gameRules")

View File

@ -27,7 +27,7 @@ public class PurgeCommand extends MultiverseCommand {
}
@Subcommand("purgeall")
@CommandPermission("multiverse.core.purge")
@CommandPermission("multiverse.core.purge.all")
@Syntax("<all|animals|monsters|mobname>")
@CommandCompletion("all|animals|monsters|@livingEntities")
@Description("Removed the specified type of mob from all worlds.")

View File

@ -41,7 +41,6 @@ public class SetSpawnCommand extends MultiverseCommand {
}
}
public class AliasSetSpawn extends BaseCommand {
@CommandAlias("mvsetspawn")

View File

@ -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());

View File

@ -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")) {