diff options
author | Paul A. <suror@gmx.co.uk> | 2012-01-24 17:29:08 -0800 |
---|---|---|
committer | Paul A. <suror@gmx.co.uk> | 2012-01-24 17:29:08 -0800 |
commit | da6ad4567aa4ab93eabf76caa3097a8f384118fa (patch) | |
tree | bde6602de4ae5023c15ec42868a262a651b1a597 /EssentialsGroupManager/src/org/anjocaido/groupmanager | |
parent | 157861ee390d00b7204264c3bc47aaa8d2ce234b (diff) | |
parent | d7bc467ee30c6f5d184965f5930bf0a0e36c6f72 (diff) | |
download | Essentials-da6ad4567aa4ab93eabf76caa3097a8f384118fa.tar Essentials-da6ad4567aa4ab93eabf76caa3097a8f384118fa.tar.gz Essentials-da6ad4567aa4ab93eabf76caa3097a8f384118fa.tar.lz Essentials-da6ad4567aa4ab93eabf76caa3097a8f384118fa.tar.xz Essentials-da6ad4567aa4ab93eabf76caa3097a8f384118fa.zip |
Merge pull request #43 from essentials/groupmanager
Fix trying to modify an unmodifiable collection breaking superperms.
Diffstat (limited to 'EssentialsGroupManager/src/org/anjocaido/groupmanager')
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index e326ff624..de42ce9c3 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -153,41 +153,42 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { // Allow * node to populate ALL perms in Bukkit. if (perms.contains("*")) { permArray.addAll(GroupManager.BukkitPermissions.getAllRegisteredPermissions(includeChildren)); - perms.remove("*"); } for (String perm : perms) { - boolean negated = false; - if (perm.startsWith("-")) - negated = true; - - if (!permArray.contains(perm)) { - permArray.add(perm); + if (!perm.equalsIgnoreCase("*")) { + boolean negated = false; + if (perm.startsWith("-")) + negated = true; - if ((negated) && (permArray.contains(perm.substring(1)))) - permArray.remove(perm.substring(1)); - - if (includeChildren) { - - Map<String, Boolean> children = GroupManager.BukkitPermissions.getAllChildren((negated ? perm.substring(1) : perm), new HashSet<String>()); - - if (children != null) { - if (negated) { - - // Remove children of negated nodes - for (String child : children.keySet()) - if (children.get(child)) - if (permArray.contains(child)) - permArray.remove(child); - - } else { - - // Add child nodes - for (String child : children.keySet()) - if (children.get(child)) - if ((!permArray.contains(child)) && (!permArray.contains("-" + child))) - permArray.add(child); + if (!permArray.contains(perm)) { + permArray.add(perm); + + if ((negated) && (permArray.contains(perm.substring(1)))) + permArray.remove(perm.substring(1)); + + if (includeChildren) { + + Map<String, Boolean> children = GroupManager.BukkitPermissions.getAllChildren((negated ? perm.substring(1) : perm), new HashSet<String>()); + + if (children != null) { + if (negated) { + + // Remove children of negated nodes + for (String child : children.keySet()) + if (children.get(child)) + if (permArray.contains(child)) + permArray.remove(child); + + } else { + + // Add child nodes + for (String child : children.keySet()) + if (children.get(child)) + if ((!permArray.contains(child)) && (!permArray.contains("-" + child))) + permArray.add(child); + } } } } |