diff --git a/common/src/main/java/me/lucko/luckperms/common/primarygroup/AllParentsByWeightHolder.java b/common/src/main/java/me/lucko/luckperms/common/primarygroup/AllParentsByWeightHolder.java index da32dc9f..af6a0df9 100644 --- a/common/src/main/java/me/lucko/luckperms/common/primarygroup/AllParentsByWeightHolder.java +++ b/common/src/main/java/me/lucko/luckperms/common/primarygroup/AllParentsByWeightHolder.java @@ -28,6 +28,7 @@ import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.User; import me.lucko.luckperms.common.utils.ExtractedContexts; +import java.util.Collections; import java.util.Comparator; import java.util.Optional; @@ -53,7 +54,7 @@ public class AllParentsByWeightHolder extends StoredHolder { .map(n -> Optional.ofNullable(user.getPlugin().getGroupManager().getIfLoaded(n.getGroupName()))) .filter(Optional::isPresent) .map(Optional::get) - .sorted(Comparator.comparingInt(o -> o.getWeight().orElse(0))) + .sorted(Collections.reverseOrder(Comparator.comparingInt(o -> o.getWeight().orElse(0)))) .findFirst() .map(Group::getName) .orElse(null); diff --git a/common/src/main/java/me/lucko/luckperms/common/primarygroup/ParentsByWeightHolder.java b/common/src/main/java/me/lucko/luckperms/common/primarygroup/ParentsByWeightHolder.java index 71d6a8a9..0930e548 100644 --- a/common/src/main/java/me/lucko/luckperms/common/primarygroup/ParentsByWeightHolder.java +++ b/common/src/main/java/me/lucko/luckperms/common/primarygroup/ParentsByWeightHolder.java @@ -26,6 +26,7 @@ import me.lucko.luckperms.api.Node; import me.lucko.luckperms.common.core.model.Group; import me.lucko.luckperms.common.core.model.User; +import java.util.Collections; import java.util.Comparator; import java.util.Optional; @@ -51,7 +52,7 @@ public class ParentsByWeightHolder extends StoredHolder { .map(n -> Optional.ofNullable(user.getPlugin().getGroupManager().getIfLoaded(n.getGroupName()))) .filter(Optional::isPresent) .map(Optional::get) - .sorted(Comparator.comparingInt(o -> o.getWeight().orElse(0))) + .sorted(Collections.reverseOrder(Comparator.comparingInt(o -> o.getWeight().orElse(0)))) .findFirst() .map(Group::getName) .orElse(null);