mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-30 22:53:27 +01:00
Fix all users sharing the same meta state
This commit is contained in:
parent
247871f678
commit
8025f3a082
@ -25,6 +25,8 @@ package me.lucko.luckperms.common.caching.stacking;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import me.lucko.luckperms.common.utils.ImmutableCollectors;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -60,4 +62,14 @@ public class GenericMetaStack implements MetaStack {
|
|||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MetaStack copy() {
|
||||||
|
return new GenericMetaStack(
|
||||||
|
elements.stream().map(MetaStackElement::copy).collect(ImmutableCollectors.toImmutableList()),
|
||||||
|
startSpacer,
|
||||||
|
middleSpacer,
|
||||||
|
endSpacer
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ public interface MetaStack {
|
|||||||
|
|
||||||
List<MetaStackElement> getElements();
|
List<MetaStackElement> getElements();
|
||||||
String toFormattedString();
|
String toFormattedString();
|
||||||
|
MetaStack copy();
|
||||||
|
|
||||||
default void accumulateToAll(LocalizedNode node) {
|
default void accumulateToAll(LocalizedNode node) {
|
||||||
getElements().forEach(m -> m.accumulateNode(node));
|
getElements().forEach(m -> m.accumulateNode(node));
|
||||||
|
@ -36,6 +36,8 @@ public interface MetaStackElement {
|
|||||||
|
|
||||||
boolean accumulateNode(LocalizedNode node);
|
boolean accumulateNode(LocalizedNode node);
|
||||||
|
|
||||||
|
MetaStackElement copy();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the types do not match
|
* Returns true if the types do not match
|
||||||
* @param expectingPrefix if the method is expecting a prefix
|
* @param expectingPrefix if the method is expecting a prefix
|
||||||
|
@ -37,4 +37,9 @@ public class NoopMetaStack implements MetaStack {
|
|||||||
public String toFormattedString() {
|
public String toFormattedString() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MetaStack copy() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,4 +65,9 @@ public class HighestPriorityElement implements MetaStackElement {
|
|||||||
this.entry = entry;
|
this.entry = entry;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MetaStackElement copy() {
|
||||||
|
return new HighestPriorityElement(prefix);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,4 +59,9 @@ public class HighestPriorityOwnElement implements MetaStackElement {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MetaStackElement copy() {
|
||||||
|
return new HighestPriorityOwnElement(prefix);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -62,4 +62,9 @@ public class HighestPriorityTrackElement implements MetaStackElement {
|
|||||||
this.entry = entry;
|
this.entry = entry;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MetaStackElement copy() {
|
||||||
|
return new HighestPriorityTrackElement(prefix, plugin, trackName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,4 +65,9 @@ public class LowestPriorityElement implements MetaStackElement {
|
|||||||
this.entry = entry;
|
this.entry = entry;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MetaStackElement copy() {
|
||||||
|
return new LowestPriorityElement(prefix);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,4 +58,9 @@ public class LowestPriorityOwnElement implements MetaStackElement {
|
|||||||
this.entry = entry;
|
this.entry = entry;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MetaStackElement copy() {
|
||||||
|
return new LowestPriorityOwnElement(prefix);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,4 +62,9 @@ public class LowestPriorityTrackElement implements MetaStackElement {
|
|||||||
this.entry = entry;
|
this.entry = entry;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MetaStackElement copy() {
|
||||||
|
return new LowestPriorityTrackElement(prefix, plugin, trackName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -468,8 +468,8 @@ public abstract class PermissionHolder {
|
|||||||
public MetaHolder accumulateMeta(MetaHolder holder, List<String> excludedGroups, ExtractedContexts contexts) {
|
public MetaHolder accumulateMeta(MetaHolder holder, List<String> excludedGroups, ExtractedContexts contexts) {
|
||||||
if (holder == null) {
|
if (holder == null) {
|
||||||
holder = new MetaHolder(
|
holder = new MetaHolder(
|
||||||
plugin.getConfiguration().get(ConfigKeys.PREFIX_FORMATTING_OPTIONS),
|
plugin.getConfiguration().get(ConfigKeys.PREFIX_FORMATTING_OPTIONS).copy(),
|
||||||
plugin.getConfiguration().get(ConfigKeys.SUFFIX_FORMATTING_OPTIONS)
|
plugin.getConfiguration().get(ConfigKeys.SUFFIX_FORMATTING_OPTIONS).copy()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user