Made tab complete only show commands with permission

This commit is contained in:
sekwah 2018-01-23 18:40:39 +00:00 committed by Sekwah
parent a762b58663
commit 829ba9bdd4

View File

@ -110,7 +110,16 @@ public class CommandWithSubCommands implements CommandTemplate {
}
}
else {
return this.subCommandRegistry.getSubCommands();
List<String> allowedCommands = new ArrayList<>();
for (String subCommandName : this.subCommandRegistry.getSubCommands()) {
if (subCommandName.equalsIgnoreCase(args[0])) {
SubCommand subCommand = this.getSubCommand(subCommandName);
if(subCommand.hasPermission(sender)) {
allowedCommands.add(subCommandName);
}
}
}
return allowedCommands;
}
return null;
}