mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-24 19:46:32 +01:00
Fix primary groups being selected in reverse order
This commit is contained in:
parent
2e75bc3f3b
commit
c2165e0196
@ -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.core.model.User;
|
||||||
import me.lucko.luckperms.common.utils.ExtractedContexts;
|
import me.lucko.luckperms.common.utils.ExtractedContexts;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ public class AllParentsByWeightHolder extends StoredHolder {
|
|||||||
.map(n -> Optional.ofNullable(user.getPlugin().getGroupManager().getIfLoaded(n.getGroupName())))
|
.map(n -> Optional.ofNullable(user.getPlugin().getGroupManager().getIfLoaded(n.getGroupName())))
|
||||||
.filter(Optional::isPresent)
|
.filter(Optional::isPresent)
|
||||||
.map(Optional::get)
|
.map(Optional::get)
|
||||||
.sorted(Comparator.comparingInt(o -> o.getWeight().orElse(0)))
|
.sorted(Collections.reverseOrder(Comparator.comparingInt(o -> o.getWeight().orElse(0))))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.map(Group::getName)
|
.map(Group::getName)
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
@ -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.Group;
|
||||||
import me.lucko.luckperms.common.core.model.User;
|
import me.lucko.luckperms.common.core.model.User;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ public class ParentsByWeightHolder extends StoredHolder {
|
|||||||
.map(n -> Optional.ofNullable(user.getPlugin().getGroupManager().getIfLoaded(n.getGroupName())))
|
.map(n -> Optional.ofNullable(user.getPlugin().getGroupManager().getIfLoaded(n.getGroupName())))
|
||||||
.filter(Optional::isPresent)
|
.filter(Optional::isPresent)
|
||||||
.map(Optional::get)
|
.map(Optional::get)
|
||||||
.sorted(Comparator.comparingInt(o -> o.getWeight().orElse(0)))
|
.sorted(Collections.reverseOrder(Comparator.comparingInt(o -> o.getWeight().orElse(0))))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.map(Group::getName)
|
.map(Group::getName)
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
Loading…
Reference in New Issue
Block a user