From c3b3e390b0e32cf5dcc336b360eb7aeb3b8e7673 Mon Sep 17 00:00:00 2001 From: graywolf336 Date: Tue, 28 Jan 2014 22:34:39 -0600 Subject: [PATCH] Make the subcommands of /jail work. :) --- src/main/java/com/graywolf336/jail/command/JailHandler.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/graywolf336/jail/command/JailHandler.java b/src/main/java/com/graywolf336/jail/command/JailHandler.java index ee453c3..6553511 100644 --- a/src/main/java/com/graywolf336/jail/command/JailHandler.java +++ b/src/main/java/com/graywolf336/jail/command/JailHandler.java @@ -94,13 +94,15 @@ public class JailHandler { } // Now, let's check the size of the arguments passed. If it is shorter than the minimum required args, let's show the usage. - if(args.length < i.minimumArgs()) { + // The reason we are subtracting one is because the command is now `/jail ` and the subcommand is viewed as an argument + if(args.length - 1 < i.minimumArgs()) { showUsage(sender, c); return false; } // Then, if the maximumArgs doesn't equal -1, we need to check if the size of the arguments passed is greater than the maximum args. - if(i.maxArgs() != -1 && i.maxArgs() < args.length) { + // The reason we are subtracting one is because the command is now `/jail ` and the subcommand is viewed as an argument + if(i.maxArgs() != -1 && i.maxArgs() < args.length - 1) { showUsage(sender, c); return false; }