1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-10-02 09:07:08 +02:00

Fixed GM to recognize Superperm child nodes.

If you add a node like Towny.admin GM will now correctly report on
all child nodes.
This commit is contained in:
ElgarL
2011-10-28 18:43:29 +01:00
parent fadfc490a7
commit 819c8f3aa9
4 changed files with 55 additions and 4 deletions

View File

@@ -150,8 +150,19 @@ public class BukkitPermissions {
value = true;
}
if (value == true)
if (value == true){
// Set the root permission
attachment.setPermission(permission, value);
// fetch and set all children of this permission node
Map<String, Boolean> children = permission.getChildren();
if (children != null) {
for (String child : children.keySet()) {
if (children.get(child))
attachment.setPermission(child, true);
}
}
}
}
// Add any missing permissions for this player (non bukkit plugins)
@@ -171,6 +182,22 @@ public class BukkitPermissions {
player.recalculatePermissions();
}
/**
* Returns a map of the child permissions as defined by the supplying plugin
* null is empty
*
* @param node
* @return
*/
public Map<String, Boolean> getChildren(String node) {
for (Permission permission : registeredPermissions) {
if (permission.getName() == node) {
return permission.getChildren();
}
}
return null;
}
public List<String> listPerms(Player player) {
List<String> perms = new ArrayList<String>();