mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-07 03:19:47 +01:00
Fix issue with permissions sometimes not being removed
This commit is contained in:
parent
c88600adda
commit
18e126b781
@ -111,31 +111,28 @@ public abstract class PermissionHolder {
|
|||||||
* @return true if permissions had expired and were removed
|
* @return true if permissions had expired and were removed
|
||||||
*/
|
*/
|
||||||
public boolean auditTemporaryPermissions() {
|
public boolean auditTemporaryPermissions() {
|
||||||
boolean work = false;
|
final boolean[] work = {false};
|
||||||
|
final PermissionHolder instance = this;
|
||||||
|
|
||||||
Iterator<Node> iterator = nodes.iterator();
|
nodes.removeIf(node -> {
|
||||||
while (iterator.hasNext()) {
|
if (node.hasExpired()) {
|
||||||
Node element = iterator.next();
|
work[0] = true;
|
||||||
if (element.hasExpired()) {
|
plugin.getApiProvider().fireEventAsync(new PermissionNodeExpireEvent(new PermissionHolderLink(instance), node));
|
||||||
iterator.remove();
|
return true;
|
||||||
|
|
||||||
work = true;
|
|
||||||
plugin.getApiProvider().fireEventAsync(new PermissionNodeExpireEvent(new PermissionHolderLink(this), element));
|
|
||||||
}
|
}
|
||||||
}
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
Iterator<Node> iterator2 = transientNodes.iterator();
|
transientNodes.removeIf(node -> {
|
||||||
while (iterator2.hasNext()) {
|
if (node.hasExpired()) {
|
||||||
Node element = iterator2.next();
|
work[0] = true;
|
||||||
if (element.hasExpired()) {
|
plugin.getApiProvider().fireEventAsync(new PermissionNodeExpireEvent(new PermissionHolderLink(instance), node));
|
||||||
iterator2.remove();
|
return true;
|
||||||
|
|
||||||
work = true;
|
|
||||||
plugin.getApiProvider().fireEventAsync(new PermissionNodeExpireEvent(new PermissionHolderLink(this), element));
|
|
||||||
}
|
}
|
||||||
}
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
return work;
|
return work[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -163,25 +160,11 @@ public abstract class PermissionHolder {
|
|||||||
contexts.remove("server");
|
contexts.remove("server");
|
||||||
contexts.remove("world");
|
contexts.remove("world");
|
||||||
|
|
||||||
Iterator<Node> iterator = parents.iterator();
|
parents.removeIf(node ->
|
||||||
while (iterator.hasNext()) {
|
!node.shouldApplyOnServer(server, context.isApplyGlobalGroups(), plugin.getConfiguration().isApplyingRegex()) ||
|
||||||
Node node = iterator.next();
|
!node.shouldApplyOnWorld(world, context.isApplyGlobalWorldGroups(), plugin.getConfiguration().isApplyingRegex()) ||
|
||||||
|
!node.shouldApplyWithContext(contexts, false)
|
||||||
if (!node.shouldApplyOnServer(server, context.isApplyGlobalGroups(), plugin.getConfiguration().isApplyingRegex())) {
|
);
|
||||||
iterator.remove();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!node.shouldApplyOnWorld(world, context.isApplyGlobalWorldGroups(), plugin.getConfiguration().isApplyingRegex())) {
|
|
||||||
iterator.remove();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!node.shouldApplyWithContext(contexts, false)) {
|
|
||||||
iterator.remove();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Node parent : parents) {
|
for (Node parent : parents) {
|
||||||
Group group = plugin.getGroupManager().get(parent.getGroupName());
|
Group group = plugin.getGroupManager().get(parent.getGroupName());
|
||||||
@ -488,13 +471,7 @@ public abstract class PermissionHolder {
|
|||||||
throw new ObjectLacksException();
|
throw new ObjectLacksException();
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator<Node> iterator = nodes.iterator();
|
nodes.removeIf(e -> e.almostEquals(node));
|
||||||
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),
|
||||||
@ -514,13 +491,7 @@ public abstract class PermissionHolder {
|
|||||||
throw new ObjectLacksException();
|
throw new ObjectLacksException();
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator<Node> iterator = transientNodes.iterator();
|
transientNodes.removeIf(e -> e.almostEquals(node));
|
||||||
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),
|
||||||
|
Loading…
Reference in New Issue
Block a user