mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +01:00
Migrate PEX primary groups
This commit is contained in:
parent
35cb5b81dc
commit
3ddbf1da87
@ -404,6 +404,22 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
||||
}
|
||||
}
|
||||
|
||||
String primary = null;
|
||||
int weight = -100;
|
||||
for (PermissionGroup group : user.getOwnParents()) {
|
||||
if (group.getRank() > weight) {
|
||||
primary = group.getName();
|
||||
weight = group.getWeight();
|
||||
}
|
||||
}
|
||||
|
||||
if (primary != null) {
|
||||
try {
|
||||
lpUser.setPermission("group." + primary.toLowerCase(), true);
|
||||
} catch (ObjectAlreadyHasException ignored) {}
|
||||
lpUser.setPrimaryGroup(primary);
|
||||
}
|
||||
|
||||
plugin.getUserManager().cleanup(lpUser);
|
||||
plugin.getDatastore().saveUser(lpUser);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user