mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +01:00
Submit users/groups to the editor in weight order
This commit is contained in:
parent
6c0bb61cb1
commit
cd5447de38
@ -74,10 +74,17 @@ public class EditorCommand extends SingleCommand {
|
|||||||
// collect holders
|
// collect holders
|
||||||
List<PermissionHolder> holders = new ArrayList<>();
|
List<PermissionHolder> holders = new ArrayList<>();
|
||||||
if (type.includingGroups) {
|
if (type.includingGroups) {
|
||||||
holders.addAll(plugin.getGroupManager().getAll().values());
|
plugin.getGroupManager().getAll().values().stream()
|
||||||
|
.sorted((o1, o2) -> {
|
||||||
|
int i = Integer.compare(o2.getWeight().orElse(0), o1.getWeight().orElse(0));
|
||||||
|
return i != 0 ? i : o1.getName().compareToIgnoreCase(o2.getName());
|
||||||
|
})
|
||||||
|
.forEach(holders::add);
|
||||||
}
|
}
|
||||||
if (type.includingUsers) {
|
if (type.includingUsers) {
|
||||||
holders.addAll(plugin.getUserManager().getAll().values());
|
plugin.getUserManager().getAll().values().stream()
|
||||||
|
.sorted((o1, o2) -> o1.getFriendlyName().compareToIgnoreCase(o2.getFriendlyName()))
|
||||||
|
.forEach(holders::add);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove holders which the sender doesn't have perms to view
|
// remove holders which the sender doesn't have perms to view
|
||||||
|
Loading…
Reference in New Issue
Block a user