Merge branch 'master' into release

This commit is contained in:
ementalo 2012-01-25 14:29:05 +00:00
commit 270533652b
4 changed files with 33 additions and 31 deletions

View file

@ -118,3 +118,4 @@ v 1.9:
- addSubGroup now returns a boolean for success/failure. - addSubGroup now returns a boolean for success/failure.
- '/manuaddsub' now correctly reports if it was able to add the sub group. - '/manuaddsub' now correctly reports if it was able to add the sub group.
- Allow negation to the * permission node when populating superperms. - Allow negation to the * permission node when populating superperms.
- Fix trying to modify an unmodifiable collection breaking superperms.

View file

@ -153,41 +153,42 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
// Allow * node to populate ALL perms in Bukkit. // Allow * node to populate ALL perms in Bukkit.
if (perms.contains("*")) { if (perms.contains("*")) {
permArray.addAll(GroupManager.BukkitPermissions.getAllRegisteredPermissions(includeChildren)); permArray.addAll(GroupManager.BukkitPermissions.getAllRegisteredPermissions(includeChildren));
perms.remove("*");
} }
for (String perm : perms) { for (String perm : perms) {
boolean negated = false; if (!perm.equalsIgnoreCase("*")) {
if (perm.startsWith("-")) boolean negated = false;
negated = true; if (perm.startsWith("-"))
negated = true;
if (!permArray.contains(perm)) { if (!permArray.contains(perm)) {
permArray.add(perm); permArray.add(perm);
if ((negated) && (permArray.contains(perm.substring(1)))) if ((negated) && (permArray.contains(perm.substring(1))))
permArray.remove(perm.substring(1)); permArray.remove(perm.substring(1));
if (includeChildren) { if (includeChildren) {
Map<String, Boolean> children = GroupManager.BukkitPermissions.getAllChildren((negated ? perm.substring(1) : perm), new HashSet<String>()); Map<String, Boolean> children = GroupManager.BukkitPermissions.getAllChildren((negated ? perm.substring(1) : perm), new HashSet<String>());
if (children != null) { if (children != null) {
if (negated) { if (negated) {
// Remove children of negated nodes // Remove children of negated nodes
for (String child : children.keySet()) for (String child : children.keySet())
if (children.get(child)) if (children.get(child))
if (permArray.contains(child)) if (permArray.contains(child))
permArray.remove(child); permArray.remove(child);
} else { } else {
// Add child nodes // Add child nodes
for (String child : children.keySet()) for (String child : children.keySet())
if (children.get(child)) if (children.get(child))
if ((!permArray.contains(child)) && (!permArray.contains("-" + child))) if ((!permArray.contains(child)) && (!permArray.contains("-" + child)))
permArray.add(child); permArray.add(child);
}
} }
} }
} }

Binary file not shown.

Binary file not shown.