From e1db27010c60d8dc4dd45ba5bc5b232c9c73612a Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Wed, 4 Sep 2019 03:01:25 +0200 Subject: [PATCH] Updating command usage formats --- .../intellectualsites/plotsquared/plot/commands/Alias.java | 4 ++-- .../plotsquared/plot/commands/Condense.java | 3 ++- .../plotsquared/plot/commands/Continue.java | 2 +- .../plotsquared/plot/commands/Database.java | 4 ++-- .../plotsquared/plot/commands/FlagCmd.java | 5 ++--- .../intellectualsites/plotsquared/plot/commands/Inbox.java | 6 ++---- .../intellectualsites/plotsquared/plot/commands/Owner.java | 2 +- .../plotsquared/plot/commands/SchematicCmd.java | 2 +- .../plotsquared/plot/commands/Template.java | 3 +-- .../intellectualsites/plotsquared/plot/commands/Toggle.java | 4 +++- 10 files changed, 17 insertions(+), 18 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java index 7f335cfa5..e4a719dcf 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Alias.java @@ -21,7 +21,7 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; @Override public boolean onCommand(PlotPlayer player, String[] args) { if (args.length == 0) { - Captions.COMMAND_SYNTAX.send(player, "/plot alias "); + Captions.COMMAND_SYNTAX.send(player, getUsage()); return false; } @@ -64,7 +64,7 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler; } break; default: - Captions.COMMAND_SYNTAX.send(player, "/plot alias "); + Captions.COMMAND_SYNTAX.send(player, getUsage()); result = false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java index 184e2289d..a9341f373 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Condense.java @@ -20,6 +20,7 @@ import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; @CommandDeclaration(command = "condense", permission = "plots.admin", + usage = "/plot condense [radius]", description = "Condense a plotworld", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.CONSOLE) public class Condense extends SubCommand { @@ -27,7 +28,7 @@ import java.util.concurrent.atomic.AtomicBoolean; @Override public boolean onCommand(final PlotPlayer player, String[] args) { if (args.length != 2 && args.length != 3) { - MainUtil.sendMessage(player, "/plot condense [radius]"); + MainUtil.sendMessage(player, getUsage()); return false; } PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java index 4aec2d6d0..961742c1b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Continue.java @@ -12,7 +12,7 @@ import com.github.intellectualsites.plotsquared.plot.util.Permissions; @CommandDeclaration(command = "continue", description = "Continue a plot that was previously marked as done", permission = "plots.continue", category = CommandCategory.SETTINGS, - requiredType = RequiredType.NONE) public class Continue extends SubCommand { + requiredType = RequiredType.PLAYER) public class Continue extends SubCommand { @Override public boolean onCommand(PlotPlayer player, String[] args) { Plot plot = player.getCurrentPlot(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java index d908f2105..abbddc9ca 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Database.java @@ -48,7 +48,7 @@ import java.util.Map.Entry; @Override public boolean onCommand(final PlotPlayer player, String[] args) { if (args.length < 1) { - MainUtil.sendMessage(player, "/plot database [area] "); + MainUtil.sendMessage(player, getUsage()); return false; } List plots; @@ -60,7 +60,7 @@ import java.util.Map.Entry; plots = PlotSquared.get().sortPlotsByTemp(PlotSquared.get().getPlots()); } if (args.length < 1) { - MainUtil.sendMessage(player, "/plot database [world] "); + MainUtil.sendMessage(player, getUsage()); MainUtil.sendMessage(player, "[arg] indicates an optional argument"); return false; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java index 470d8d605..b55895494 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/FlagCmd.java @@ -87,8 +87,7 @@ import java.util.*; * plot flag list */ if (args.length == 0) { - MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, - "/plot flag "); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, getUsage()); return false; } Location loc = player.getLocation(); @@ -311,7 +310,7 @@ import java.util.*; return true; } MainUtil - .sendMessage(player, Captions.COMMAND_SYNTAX, "/plot flag "); + .sendMessage(player, Captions.COMMAND_SYNTAX, getUsage()); return false; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java index 8d427bbcd..c0c898205 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Inbox.java @@ -71,8 +71,7 @@ import java.util.List; return false; } if (args.length == 0) { - sendMessage(player, Captions.COMMAND_SYNTAX, - "/plot inbox [inbox] [delete |clear|page]"); + sendMessage(player, Captions.COMMAND_SYNTAX, getUsage()); for (final CommentInbox inbox : CommentManager.inboxes.values()) { if (inbox.canRead(plot, player)) { if (!inbox.getComments(plot, new RunnableVal>() { @@ -172,8 +171,7 @@ import java.util.List; try { page = Integer.parseInt(args[1]); } catch (NumberFormatException ignored) { - sendMessage(player, Captions.COMMAND_SYNTAX, - "/plot inbox [inbox] [delete |clear|page]"); + sendMessage(player, Captions.COMMAND_SYNTAX, getUsage()); return false; } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java index 55dbdbda4..98e32dcd6 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Owner.java @@ -17,7 +17,7 @@ import java.util.UUID; @CommandDeclaration(command = "setowner", permission = "plots.set.owner", description = "Set the plot owner", usage = "/plot setowner ", aliases = {"owner", "so", "seto"}, category = CommandCategory.CLAIMING, - requiredType = RequiredType.NONE, confirmation = true) public class Owner extends SetCommand { + requiredType = RequiredType.PLAYER, confirmation = true) public class Owner extends SetCommand { @Override public boolean set(final PlotPlayer player, final Plot plot, String value) { Set plots = plot.getConnectedPlots(); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java index f654fa776..deef2081c 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/SchematicCmd.java @@ -25,7 +25,7 @@ import java.util.UUID; @CommandDeclaration(command = "schematic", permission = "plots.schematic", description = "Schematic command", aliases = {"sch", "schem"}, - category = CommandCategory.SCHEMATIC, usage = "/plot schematic ") + category = CommandCategory.SCHEMATIC, usage = "/plot schematic ") public class SchematicCmd extends SubCommand { private boolean running = false; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java index eb96f78cc..563956c46 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Template.java @@ -113,8 +113,7 @@ import java.util.zip.ZipOutputStream; return true; } } - MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, - "/plot template [template]"); + MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX, getUsage()); return true; } final String world = args[1]; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java index e19d81762..efe54f3d8 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Toggle.java @@ -9,14 +9,16 @@ import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3; import com.github.intellectualsites.plotsquared.plot.util.MainUtil; @CommandDeclaration(command = "toggle", aliases = {"attribute"}, permission = "plots.use", + usage = "/plot toggle ", description = "Toggle per user settings", requiredType = RequiredType.NONE, category = CommandCategory.SETTINGS) public class Toggle extends Command { + public Toggle() { super(MainCommand.getInstance(), true); } @CommandDeclaration(command = "chatspy", aliases = {"spy"}, - permission = "plots.admin.command.chat", description = "Toggle admin chat spying") + permission = "plots.admin.command.chat", description = "Toggle plot chat spy") public void chatspy(Command command, PlotPlayer player, String[] args, RunnableVal3 confirm, RunnableVal2 whenDone) {