diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/C.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/C.java index 5dcc54eaf..cd911d7ee 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/C.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/C.java @@ -139,6 +139,7 @@ public enum C { */ NOT_VALID_SUBCOMMAND("&cThat is not a valid subcommand"), DID_YOU_MEAN("&cDid you mean: &6%s"), + NAME_LITTLE("&c%s name is too short, &6%s&c<&6%s"), NO_COMMANDS("&cI'm sorry, but you're not permitted to use any subcommands."), SUBCOMMAND_SET_OPTIONS_HEADER("&cPossible Values: "), /* diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java index 3e54e5f15..43fd0a0f9 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java @@ -159,6 +159,7 @@ public class MainCommand implements CommandExecutor, TabCompleter { if(!(commandSender instanceof Player)) return null; Player player = (Player) commandSender; ArrayList subo = subCommands; + if(strings.length < 1 || strings[0].length() < 2) return null; while(true) { String sub = new StringComparsion(strings[0], subo.toArray()).getBestMatch(); if(subo.isEmpty()) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java index bf5582684..e53ed5781 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java @@ -217,6 +217,10 @@ public class Set extends SubCommand { PlayerFunctions.sendMessage(plr, C.NEED_BIOME); return true; } + if(args[1].length() < 2) { + sendMessage(plr, C.NAME_LITTLE, "Biome", args[1].length() + "", "2"); + return true; + } Biome biome = Biome.valueOf(new StringComparsion(args[1], Biome.values()).getBestMatch()); /*for (Biome b : Biome.values()) { if (b.toString().equalsIgnoreCase(args[1])) { @@ -243,6 +247,10 @@ public class Set extends SubCommand { PlayerFunctions.sendMessage(plr, C.NEED_BLOCK); return true; } + if(args[1].length() < 2) { + sendMessage(plr, C.NAME_LITTLE, "Material", args[1].length() + "", "2"); + return true; + } Material material = getMaterial(args[1], PlotWorld.BLOCKS); /*for (Material m : PlotWorld.BLOCKS) { if (m.toString().equalsIgnoreCase(args[1])) { @@ -297,6 +305,10 @@ public class Set extends SubCommand { s = s.replaceAll(",", ""); String[] ss = s.split(";"); ss[0] = ss[0].replaceAll(";", ""); + if(ss[0].length() < 2) { + sendMessage(plr, C.NAME_LITTLE, "Material", ss[0].length() + "", "2"); + return true; + } m = getMaterial(ss[0], materials); /*for (Material ma : materials) { if (ma.toString().equalsIgnoreCase(ss[0])) { @@ -336,6 +348,10 @@ public class Set extends SubCommand { PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD); return true; } + if(args[1].length() < 2) { + sendMessage(plr, C.NAME_LITTLE, "Material", args[1].length() + "", "2"); + return true; + } Material material = getMaterial(args[1], PlotWorld.BLOCKS); /*for (Material m : PlotWorld.BLOCKS) { if (m.toString().equalsIgnoreCase(args[1])) {