From d7bc467ee30c6f5d184965f5930bf0a0e36c6f72 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Wed, 25 Jan 2012 01:20:44 +0000 Subject: Fix trying to modify an unmodifiable collection breaking superperms. --- EssentialsGroupManager/src/Changelog.txt | 3 +- .../permissions/AnjoPermissionsHandler.java | 61 +++++++++++----------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 70f778247..5307c43dc 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -117,4 +117,5 @@ v 1.9: - Changed addSubGroup() to only add the group if it doesn't already exist (no need to update an already existing group). - addSubGroup now returns a boolean for success/failure. - '/manuaddsub' now correctly reports if it was able to add the sub group. - - Allow negation to the * permission node when populating superperms. \ No newline at end of file + - Allow negation to the * permission node when populating superperms. + - Fix trying to modify an unmodifiable collection breaking superperms. \ No newline at end of file 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 children = GroupManager.BukkitPermissions.getAllChildren((negated ? perm.substring(1) : perm), new HashSet()); - - 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 children = GroupManager.BukkitPermissions.getAllChildren((negated ? perm.substring(1) : perm), new HashSet()); + + 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); + } } } } -- cgit v1.2.3