This commit is contained in:
Tobias Ottenweller 2013-06-23 20:13:53 +02:00
parent ec2caaad97
commit 437296262c

View File

@ -92,7 +92,7 @@ public abstract class BaseCommand
protected boolean validateCall() protected boolean validateCall()
{ {
boolean allParamtertersThere = parameters.size() >= requiredParameters.size(); boolean allParametersThere = parameters.size() >= requiredParameters.size();
boolean senderIsPlayer = this.sender instanceof Player; boolean senderIsPlayer = this.sender instanceof Player;
boolean hasGateParameter = false; boolean hasGateParameter = false;
@ -108,19 +108,18 @@ public abstract class BaseCommand
valid = false; valid = false;
} }
else { else {
if (!allParamtertersThere) { if (!allParametersThere) {
sendMessage(ChatColor.RED + "Some parameters are missing! " + ChatColor.AQUA + "Usage: " + this.getUsageTemplate(true)); sendMessage(ChatColor.RED + "Some parameters are missing! " + ChatColor.AQUA + "Usage: " + this.getUsageTemplate(true));
valid = false; valid = false;
} else if (!senderHasPermission && this.hasGateParam) { }
else if ((!senderHasPermission && this.hasGateParam) ||
(!senderHasPermission) ||
(this.hasGateParam && !hasGateParameter)) {
sendMessage(ChatColor.RED + "You either provided a invalid gate or do not have permission to " + this.helpDescription.toLowerCase()); sendMessage(ChatColor.RED + "You either provided a invalid gate or do not have permission to " + this.helpDescription.toLowerCase());
valid = false; valid = false;
} else if (!senderHasPermission) { }
sendMessage(ChatColor.RED + "You lack the permissions to " + this.helpDescription.toLowerCase()); else {
valid = false;
} else if (this.hasGateParam && !hasGateParameter) {
sendMessage(ChatColor.RED + "There exists no gate with id " + this.parameters.get(0));
valid = false;
} else {
valid = true; valid = true;
} }
} }