diff --git a/common/src/main/java/me/lucko/luckperms/core/PermissionHolder.java b/common/src/main/java/me/lucko/luckperms/core/PermissionHolder.java index bd334a81..90993f5e 100644 --- a/common/src/main/java/me/lucko/luckperms/core/PermissionHolder.java +++ b/common/src/main/java/me/lucko/luckperms/core/PermissionHolder.java @@ -24,6 +24,7 @@ package me.lucko.luckperms.core; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.ImmutableSortedSet; import lombok.AccessLevel; import lombok.Getter; import lombok.RequiredArgsConstructor; @@ -71,8 +72,8 @@ public abstract class PermissionHolder { private final Set nodes = new HashSet<>(); private final Set transientNodes = new HashSet<>(); - private Cache> cache = new Cache<>(); - private Cache> mergedCache = new Cache<>(); + private Cache> cache = new Cache<>(); + private Cache> mergedCache = new Cache<>(); private Cache> enduringCache = new Cache<>(); private Cache> transientCache = new Cache<>(); @@ -172,7 +173,7 @@ public abstract class PermissionHolder { * @return the holders transient and permanent nodes */ public SortedSet getPermissions(boolean mergeTemp) { - Supplier> supplier = () -> { + Supplier> supplier = () -> { TreeSet combined = new TreeSet<>(PriorityComparator.reverse()); getNodes().stream() @@ -196,7 +197,7 @@ public abstract class PermissionHolder { permissions.add(node); } - return permissions; + return ImmutableSortedSet.copyOfSorted(permissions); }; return mergeTemp ? mergedCache.get(supplier) : cache.get(supplier);