mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2025-01-01 14:07:56 +01:00
Operations to add new nodes with differing values should just override existing entries, instead of failing with the ALREADY_HAS result (#1198)
This commit is contained in:
parent
04e511026d
commit
d28170cc3f
@ -181,9 +181,16 @@ public final class NodeMap {
|
||||
ImmutableContextSet context = node.getFullContexts().makeImmutable();
|
||||
LocalizedNode n = localise(node);
|
||||
|
||||
this.map.put(context, n);
|
||||
if (node.isGroupNode() && node.getValue()) {
|
||||
this.inheritanceMap.put(context, n);
|
||||
SortedSet<LocalizedNode> nodesInContext = this.map.get(context);
|
||||
nodesInContext.removeIf(e -> e.equals(node, StandardNodeEquality.IGNORE_EXPIRY_TIME_AND_VALUE));
|
||||
nodesInContext.add(n);
|
||||
|
||||
if (node.isGroupNode()) {
|
||||
SortedSet<LocalizedNode> groupNodesInContext = this.inheritanceMap.get(context);
|
||||
groupNodesInContext.removeIf(e -> e.equals(node, StandardNodeEquality.IGNORE_EXPIRY_TIME_AND_VALUE));
|
||||
if (node.getValue()) {
|
||||
groupNodesInContext.add(n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -539,7 +539,7 @@ public abstract class PermissionHolder {
|
||||
}
|
||||
|
||||
public DataMutateResult setPermission(Node node, boolean callEvent) {
|
||||
if (hasPermission(NodeMapType.ENDURING, node, StandardNodeEquality.IGNORE_EXPIRY_TIME_AND_VALUE) != Tristate.UNDEFINED) {
|
||||
if (hasPermission(NodeMapType.ENDURING, node, StandardNodeEquality.IGNORE_EXPIRY_TIME) != Tristate.UNDEFINED) {
|
||||
return DataMutateResult.ALREADY_HAS;
|
||||
}
|
||||
|
||||
@ -565,7 +565,7 @@ public abstract class PermissionHolder {
|
||||
}
|
||||
|
||||
public DataMutateResult setTransientPermission(Node node) {
|
||||
if (hasPermission(NodeMapType.TRANSIENT, node, StandardNodeEquality.IGNORE_EXPIRY_TIME_AND_VALUE) != Tristate.UNDEFINED) {
|
||||
if (hasPermission(NodeMapType.TRANSIENT, node, StandardNodeEquality.IGNORE_EXPIRY_TIME) != Tristate.UNDEFINED) {
|
||||
return DataMutateResult.ALREADY_HAS;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user