Move default permissions out of Commands and into PermissionNode - fixes #606

This commit is contained in:
EbonJaguar
2016-05-30 16:47:48 -04:00
parent 8a0655e333
commit 3ad00a45f9
13 changed files with 150 additions and 177 deletions
@@ -285,15 +285,14 @@ public class PermissionsManager implements PermissionsService {
}
public boolean hasPermission(CommandSender sender, CommandDescription command) {
if (command.getCommandPermissions() == null
|| CollectionUtils.isEmpty(command.getCommandPermissions().getPermissionNodes())) {
if (command.getPermission() == null) {
return true;
}
DefaultPermission defaultPermission = command.getCommandPermissions().getDefaultPermission();
DefaultPermission defaultPermission = command.getPermission().getDefaultPermission();
boolean def = evaluateDefaultPermission(defaultPermission, sender);
return (sender instanceof Player)
? hasPermission((Player) sender, command.getCommandPermissions().getPermissionNodes(), def)
? hasPermission((Player) sender, command.getPermission().getNode(), def)
: def;
}