From 2acfbf098edd302cd5703981143441d69c906a7f Mon Sep 17 00:00:00 2001 From: graywolf336 Date: Tue, 28 Jan 2014 16:23:20 -0600 Subject: [PATCH] Quick fix, but let's parse the jail command if no args. --- .../graywolf336/jail/command/JailHandler.java | 46 ++++++++++--------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/graywolf336/jail/command/JailHandler.java b/src/main/java/com/graywolf336/jail/command/JailHandler.java index 3b54a38..ee453c3 100644 --- a/src/main/java/com/graywolf336/jail/command/JailHandler.java +++ b/src/main/java/com/graywolf336/jail/command/JailHandler.java @@ -30,28 +30,32 @@ public class JailHandler { } public void handleCommand(JailManager jm, CommandSender sender, String... args) { - JailFoundation foundation = new JailFoundation(); - JCommander jc = new JCommander(foundation); - - //Now let's add the subcommands - jc.addCommand("list", new ListJails()); - - try { - jc.parse(args); - - List matches = getMatches(jc.getParsedCommand()); - - if(matches.size() == 0) { - //There should only be one for /jail - parseCommand(jm, sender, getMatches("jail").get(0), args); - } else if(matches.size() > 1) { - for(Command c : matches) - showUsage(sender, c); - }else { - parseCommand(jm, sender, matches.get(0), args); - } - }catch(ParameterException e) { + if(args.length == 0) { parseCommand(jm, sender, getMatches("jail").get(0), args); + }else { + JailFoundation foundation = new JailFoundation(); + JCommander jc = new JCommander(foundation); + + //Now let's add the subcommands + jc.addCommand("list", new ListJails()); + + try { + jc.parse(args); + + List matches = getMatches(jc.getParsedCommand()); + + if(matches.size() == 0) { + //There should only be one for /jail + parseCommand(jm, sender, getMatches("jail").get(0), args); + } else if(matches.size() > 1) { + for(Command c : matches) + showUsage(sender, c); + }else { + parseCommand(jm, sender, matches.get(0), args); + } + }catch(ParameterException e) { + parseCommand(jm, sender, getMatches("jail").get(0), args); + } } }