fix a permission check

This commit is contained in:
Aikar
2017-05-04 23:43:39 -04:00
parent 4160e8be23
commit 3cf6d8f239
@@ -54,17 +54,20 @@ public class RootCommand extends Command {
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
if (!this.defCommand.testPermission(sender)) {
return true;
}
for (int i = args.length; i >= 0; i--) {
String checkSub = StringUtils.join(args, " ", 0, i).toLowerCase();
BaseCommand subHandler = this.subCommands.get(checkSub);
if (subHandler != null) {
if (!subHandler.testPermission(sender)) {
return true;
}
subHandler.execute(sender, commandLabel, args);
return false;
}
}
if (!this.defCommand.testPermission(sender)) {
return true;
}
this.defCommand.execute(sender, commandLabel, args);
return false;
}