diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java index 6dc791341..740a46939 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java @@ -397,9 +397,8 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain { if (econ.init()) { return econ; } - System.out.println("ECONOMY ENABLED!"); } catch (Throwable ignored) { - ignored.printStackTrace(); + PS.debug("No economy detected!"); } return null; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/PS.java b/Core/src/main/java/com/intellectualcrafters/plot/PS.java index 6dc1863ee..99ce0c749 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/PS.java @@ -263,7 +263,6 @@ public class PS { TaskManager.runTask(new Runnable() { @Override public void run() { - System.out.println("SETTING UP ECON"); EconHandler.manager = PS.this.IMP.getEconomyHandler(); } }); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java index 6822bbcc0..79be191b1 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java @@ -49,10 +49,6 @@ public class Add extends SubCommand { @Override public boolean onCommand(PlotPlayer plr, String[] args) { - if (args.length != 1) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, this.getUsage()); - return true; - } Location loc = plr.getLocation(); Plot plot = loc.getPlotAbs(); if (plot == null) { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Remove.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Remove.java index a805c064b..9a2bef48b 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Remove.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Remove.java @@ -49,10 +49,6 @@ public class Remove extends SubCommand { @Override public boolean onCommand(PlotPlayer plr, String[] args) { - if (args.length != 1) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, this.getUsage()); - return true; - } Location loc = plr.getLocation(); Plot plot = loc.getPlotAbs(); if (plot == null) { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Trust.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Trust.java index 6dba72e66..5ca4548bf 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Trust.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Trust.java @@ -48,10 +48,6 @@ public class Trust extends SubCommand { @Override public boolean onCommand(PlotPlayer plr, String[] args) { - if (args.length != 1) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, this.getUsage()); - return true; - } Location loc = plr.getLocation(); Plot plot = loc.getPlotAbs(); if (plot == null) { diff --git a/Core/src/main/java/com/plotsquared/general/commands/Command.java b/Core/src/main/java/com/plotsquared/general/commands/Command.java index dcb3e904c..7081dba7a 100644 --- a/Core/src/main/java/com/plotsquared/general/commands/Command.java +++ b/Core/src/main/java/com/plotsquared/general/commands/Command.java @@ -14,7 +14,6 @@ import com.intellectualcrafters.plot.util.MathMan; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.StringComparison; import com.intellectualcrafters.plot.util.StringMan; - import java.io.IOException; import java.lang.annotation.Annotation; import java.lang.reflect.InvocationTargetException; @@ -323,7 +322,15 @@ public abstract class Command { } return; } - Argument[] reqArgs = cmd.getRequiredArguments(); + String[] newArgs = Arrays.copyOfRange(args, 1, args.length); + if (!cmd.checkArgs(player, newArgs) || !cmd.canExecute(player, true)) { + return; + } + cmd.execute(player, newArgs, confirm, whenDone); + } + + public boolean checkArgs(PlotPlayer player, String[] args) { + Argument[] reqArgs = getRequiredArguments(); if ((reqArgs != null) && (reqArgs.length > 0)) { boolean failed = args.length < reqArgs.length; String[] baseSplit = getCommandString().split(" "); @@ -335,13 +342,10 @@ public abstract class Command { } if (failed) { C.COMMAND_SYNTAX.send(player, StringMan.join(fullSplit, " ")); - return; + return false; } } - if (!cmd.canExecute(player, true)) { - return; - } - cmd.execute(player, Arrays.copyOfRange(args, 1, args.length), confirm, whenDone); + return true; } public int getMatch(String[] args, Command cmd) {