Fix removal of temporary nodes

This commit is contained in:
Luck 2016-08-30 10:22:55 +01:00
parent 075ba33e8b
commit ba10b1c06e
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -284,7 +284,7 @@ public abstract class PermissionHolder {
private static Tristate hasPermission(Set<Node> toQuery, Node node) { private static Tristate hasPermission(Set<Node> toQuery, Node node) {
for (Node n : toQuery) { for (Node n : toQuery) {
if (n.equalsIgnoringValue(node)) { if (n.almostEquals(node)) {
return n.getTristate(); return n.getTristate();
} }
} }
@ -425,7 +425,13 @@ public abstract class PermissionHolder {
throw new ObjectLacksException(); throw new ObjectLacksException();
} }
nodes.remove(node); Iterator<Node> iterator = nodes.iterator();
while (iterator.hasNext()) {
Node entry = iterator.next();
if (entry.almostEquals(node)) {
iterator.remove();
}
}
if (node.isGroupNode()) { if (node.isGroupNode()) {
plugin.getApiProvider().fireEventAsync(new GroupRemoveEvent(new PermissionHolderLink(this), plugin.getApiProvider().fireEventAsync(new GroupRemoveEvent(new PermissionHolderLink(this),
@ -445,7 +451,13 @@ public abstract class PermissionHolder {
throw new ObjectLacksException(); throw new ObjectLacksException();
} }
transientNodes.remove(node); Iterator<Node> iterator = transientNodes.iterator();
while (iterator.hasNext()) {
Node entry = iterator.next();
if (entry.almostEquals(node)) {
iterator.remove();
}
}
if (node.isGroupNode()) { if (node.isGroupNode()) {
plugin.getApiProvider().fireEventAsync(new GroupRemoveEvent(new PermissionHolderLink(this), plugin.getApiProvider().fireEventAsync(new GroupRemoveEvent(new PermissionHolderLink(this),