From 26927d35c2f452c486200bba1299c29c4ca568be Mon Sep 17 00:00:00 2001 From: Tobias Ottenweller Date: Wed, 20 Feb 2013 14:32:37 +0100 Subject: [PATCH] Fix for Issue #14. --- src/de/craftinc/gates/commands/BaseCommand.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/de/craftinc/gates/commands/BaseCommand.java b/src/de/craftinc/gates/commands/BaseCommand.java index 4e8ab05..1dde1e4 100644 --- a/src/de/craftinc/gates/commands/BaseCommand.java +++ b/src/de/craftinc/gates/commands/BaseCommand.java @@ -75,7 +75,7 @@ public abstract class BaseCommand protected boolean validateCall() { - boolean allParamtertersThere = parameters.size() < requiredParameters.size(); + boolean allParamtertersThere = parameters.size() >= requiredParameters.size(); boolean senderIsPlayer = this.sender instanceof Player; boolean parameterIsGate = this.parameters.size() > 0 ? this.getGateForParamater(this.parameters.get(0)) : false; boolean senderHasPermission; @@ -103,17 +103,18 @@ public abstract class BaseCommand return false; } + if (!allParamtertersThere) + { + sendMessage("Usage: " + this.getUseageTemplate(true)); + return false; + } + + if (this.hasGateParam && !parameterIsGate) { sendMessage(ChatColor.RED + "There exists no gate with id " + this.parameters.get(0)); return false; } - - if (allParamtertersThere) - { - sendMessage("Usage: " + this.getUseageTemplate(true)); - return false; - } return true; }