diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandTools/MVCommandCompletions.java b/src/main/java/com/onarandombox/MultiverseCore/commandTools/MVCommandCompletions.java index e8e93438..a8ebc170 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commandTools/MVCommandCompletions.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commandTools/MVCommandCompletions.java @@ -53,6 +53,12 @@ public class MVCommandCompletions extends PaperCommandCompletions { registerStaticCompletion("addProperties", this::suggestAddProperties); registerStaticCompletion("livingEntities", this::suggestEntities); registerStaticCompletion("pasteTypes", this::suggestPasteTypes); + registerStaticCompletion("toggles", this::suggestToggles); + } + + @NotNull + private Collection suggestToggles() { + return Arrays.asList("on", "off"); } @NotNull diff --git a/src/main/java/com/onarandombox/MultiverseCore/commandTools/MVCommandContexts.java b/src/main/java/com/onarandombox/MultiverseCore/commandTools/MVCommandContexts.java index 07803119..25d4dfef 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commandTools/MVCommandContexts.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commandTools/MVCommandContexts.java @@ -146,19 +146,14 @@ public class MVCommandContexts extends PaperCommandContexts { @Nullable private Player derivePlayer(@NotNull BukkitCommandExecutionContext context) { - boolean mustBeSelf = context.hasFlag("onlyself"); - String error = (mustBeSelf) - ? "You must be a player to run this command." - : "You need to specify a player from console."; - - if (mustBeSelf || !context.hasFlag("other")) { - return getPlayerFromSelf(context, error); + if (!context.hasFlag("other")) { + return getPlayerFromSelf(context, "You must be a player to run this command."); } String playerIdentifier = context.getFirstArg(); if (playerIdentifier == null) { if (context.hasFlag("defaultself")) { - return getPlayerFromSelf(context, error); + return getPlayerFromSelf(context, "You need to specify a player from console."); } throw new InvalidCommandArgument("You need to specify a player."); } diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/AnchorCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/AnchorCommand.java index 55ae933c..888a1994 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/AnchorCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/AnchorCommand.java @@ -47,7 +47,7 @@ public class AnchorCommand extends MultiverseCommand { @CommandPermission("multiverse.core.anchor.create") @Syntax("") @Description("Create a new anchor point.") - public void onCreateAnchorCommand(@NotNull @Flags("onlyself") Player player, + public void onCreateAnchorCommand(@NotNull Player player, @NotNull @Single @Flags("type=anchor name") String anchorName) { player.sendMessage((this.plugin.getAnchorManager().saveAnchorLocation(anchorName, player.getLocation())) @@ -61,7 +61,7 @@ public class AnchorCommand extends MultiverseCommand { @CommandCompletion("@anchors") @Description("Delete an existing anchor point.") public void onDeleteAnchorCommand(@NotNull CommandSender sender, - @NotNull @Flags("type=anchor name") String anchorName) { + @NotNull @Single @Flags("type=anchor name") String anchorName) { sender.sendMessage((this.plugin.getAnchorManager().deleteAnchor(anchorName)) ? "Anchor '" + anchorName + "' was successfully " + ChatColor.RED + "deleted!" diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/BedCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/BedCommand.java index 38da1502..13062e05 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/BedCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/BedCommand.java @@ -28,7 +28,7 @@ public class BedCommand extends MultiverseCommand { @Subcommand("bed") @CommandPermission("multiverse.core.bed") @Description("Takes your current respawn point.") - public void onBedCommand(@NotNull @Flags("onlyself") Player player) { + public void onBedCommand(@NotNull Player player) { Location bedLocation = player.getBedSpawnLocation(); if (bedLocation == null) { player.sendMessage("You do have a respawn point set!"); diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/DebugCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/DebugCommand.java index eee00049..1cfaccf8 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/DebugCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/DebugCommand.java @@ -35,11 +35,11 @@ public class DebugCommand extends MultiverseCommand { } @Subcommand("debug") - @CommandCompletion("on|off|@range:3") + @CommandCompletion("@toggles|@range:3") @Syntax("") @Description("Change debug level.") public void onChangeDebugCommand(@NotNull CommandSender sender, - @NotNull @Single String debugLevel) { + @NotNull @Single String debugLevel) { int parsedLevel = parseDebugLevel(debugLevel); if (parsedLevel == -1) { diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/SetSpawnCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/SetSpawnCommand.java index b7b1f474..9a5179db 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/SetSpawnCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/SetSpawnCommand.java @@ -35,7 +35,7 @@ public class SetSpawnCommand extends MultiverseCommand { @CommandAlias("mv") public class SetSpawn extends BaseCommand { - @Subcommand("setspawn|") + @Subcommand("setspawn") @CommandPermission("multiverse.core.spawn.set") @Syntax("[world x y z [yaw pitch]]") @CommandCompletion("@MVWorlds") @@ -52,7 +52,7 @@ public class SetSpawnCommand extends MultiverseCommand { @CommandCompletion("@MVWorlds") @Description("Sets the spawn for the current world.") public void onModifySetSpawnCommand(@NotNull CommandSender sender, - @NotNull @Flags("other,defaultself,fallbackself") Location location) { + @NotNull @Flags("other,defaultself,fallbackself") Location location) { doSpawnSet(sender, location); } @@ -121,6 +121,4 @@ public class SetSpawnCommand extends MultiverseCommand { sender.sendMessage(ChatColor.RED + "There was an issue saving worlds.yml! Your changes will only be temporary!"); } } - - }