From 5a6847a0398cd31550b5a51a37d2e02883209c69 Mon Sep 17 00:00:00 2001 From: Sauilitired Date: Mon, 27 Jul 2015 21:24:04 +0200 Subject: [PATCH] Minor command fixes --- .../plot/commands/MainCommand.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java b/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java index 64957587b..18bcb74f3 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java @@ -37,6 +37,7 @@ import com.plotsquared.general.commands.Command; import com.plotsquared.general.commands.CommandHandlingOutput; import com.plotsquared.general.commands.CommandManager; +import java.text.NumberFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; @@ -209,7 +210,9 @@ public class MainCommand extends CommandManager { try { help_index = Integer.parseInt(args[2]); } - catch (NumberFormatException e) {} + catch (NumberFormatException e) { + help_index = 1; + } } break; } @@ -218,10 +221,11 @@ public class MainCommand extends CommandManager { category = null; try { help_index = Integer.parseInt(args[1]); + } catch(NumberFormatException e) { + help_index = 1; } - catch (NumberFormatException e) {} - } - if (category == null) { + } else { + help_index = 1; category = args[1]; } break; @@ -294,12 +298,12 @@ public class MainCommand extends CommandManager { MainUtil.sendMessage(plr, C.NOT_VALID_SUBCOMMAND); { ArrayList> cmds = getCommands(); - cmd = new StringComparison>(label, cmds).getMatchObject(); + cmd = new StringComparison<>(label, cmds).getMatchObject(); if (cmd == null) { MainUtil.sendMessage(plr, C.DID_YOU_MEAN, "/plot help"); } else { - MainUtil.sendMessage(plr, C.DID_YOU_MEAN, cmd.getUsage().replaceAll("{label}", label)); + MainUtil.sendMessage(plr, C.DID_YOU_MEAN, cmd.getUsage().replaceAll("\\{label\\}", label)); } } return CommandHandlingOutput.NOT_FOUND;