From 83fa310fbbffdc06075f103bd97b59494d5a1cca Mon Sep 17 00:00:00 2001 From: manuelgu Date: Mon, 28 Mar 2016 23:18:29 +0200 Subject: [PATCH] Fix ArrayIndexOutOfBoundsExceptions Occured for /plot trust and /plot add --- .../java/com/intellectualcrafters/plot/commands/Add.java | 5 ++++- .../java/com/intellectualcrafters/plot/commands/Remove.java | 3 +-- .../java/com/intellectualcrafters/plot/commands/Trust.java | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) 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 fd7e2baef..748983bcb 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Add.java @@ -31,7 +31,6 @@ import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.UUIDHandler; import com.plotsquared.general.commands.Argument; import com.plotsquared.general.commands.CommandDeclaration; - import java.util.UUID; @CommandDeclaration( @@ -50,6 +49,10 @@ 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 dfb39a87c..a0d152524 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Remove.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Remove.java @@ -29,7 +29,6 @@ import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.UUIDHandler; import com.plotsquared.general.commands.Argument; import com.plotsquared.general.commands.CommandDeclaration; - import java.util.ArrayList; import java.util.HashSet; import java.util.UUID; @@ -51,7 +50,7 @@ public class Remove extends SubCommand { @Override public boolean onCommand(PlotPlayer plr, String[] args) { if (args.length != 1) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot remove "); + MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, this.getUsage()); return true; } Location loc = plr.getLocation(); 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 f16ff0223..ff6b168d3 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Trust.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Trust.java @@ -31,7 +31,6 @@ import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.UUIDHandler; import com.plotsquared.general.commands.Argument; import com.plotsquared.general.commands.CommandDeclaration; - import java.util.UUID; @CommandDeclaration( @@ -49,7 +48,10 @@ 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) {