mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-12-29 12:37:40 +01:00
Fix bug with NodeMap#remove (#2772)
This commit is contained in:
parent
fa89236e48
commit
8ef871f6db
@ -138,7 +138,7 @@ public class NodeMapMutable extends NodeMapBase {
|
|||||||
result.recordChange(ChangeType.ADD, node);
|
result.recordChange(ChangeType.ADD, node);
|
||||||
|
|
||||||
// remove any others that were in the set already with a different value/expiry time
|
// remove any others that were in the set already with a different value/expiry time
|
||||||
removeMatching(nodes.iterator(), node, result);
|
removeMatchingButNotSame(nodes.iterator(), node, result);
|
||||||
|
|
||||||
// update the inheritanceMap too if necessary
|
// update the inheritanceMap too if necessary
|
||||||
if (node instanceof InheritanceNode) {
|
if (node instanceof InheritanceNode) {
|
||||||
@ -189,6 +189,16 @@ public class NodeMapMutable extends NodeMapBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void removeMatching(Iterator<Node> it, Node node, MutateResult result) {
|
private static void removeMatching(Iterator<Node> it, Node node, MutateResult result) {
|
||||||
|
while (it.hasNext()) {
|
||||||
|
Node el = it.next();
|
||||||
|
if (node.equals(el, NodeEqualityPredicate.IGNORE_EXPIRY_TIME_AND_VALUE)) {
|
||||||
|
it.remove();
|
||||||
|
result.recordChange(ChangeType.REMOVE, el);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void removeMatchingButNotSame(Iterator<Node> it, Node node, MutateResult result) {
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Node el = it.next();
|
Node el = it.next();
|
||||||
if (el != node && node.equals(el, NodeEqualityPredicate.IGNORE_EXPIRY_TIME_AND_VALUE)) {
|
if (el != node && node.equals(el, NodeEqualityPredicate.IGNORE_EXPIRY_TIME_AND_VALUE)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user