Add some alternate options for primary group calculation
This commit is contained in:
@@ -238,7 +238,7 @@ public class MigrationGroupManager extends SubCommand<Object> {
|
||||
String primaryGroup = primaryGroups.get(e.getKey());
|
||||
if (primaryGroup != null) {
|
||||
user.setPermissionUnchecked(NodeFactory.make("group." + primaryGroup));
|
||||
user.setPrimaryGroup(primaryGroup);
|
||||
user.getPrimaryGroup().setStoredValue(primaryGroup);
|
||||
user.unsetPermissionUnchecked(NodeFactory.make("group.default"));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -221,7 +221,7 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
||||
|
||||
if (primary != null && !primary.equalsIgnoreCase("default")) {
|
||||
lpUser.setPermissionUnchecked(NodeFactory.make("group." + primary.toLowerCase()));
|
||||
lpUser.setPrimaryGroup(primary);
|
||||
lpUser.getPrimaryGroup().setStoredValue(primary);
|
||||
lpUser.unsetPermissionUnchecked(NodeFactory.make("group.default"));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -262,7 +262,7 @@ public class MigrationPowerfulPerms extends SubCommand<Object> {
|
||||
String primary = joinFuture(pm.getPlayerPrimaryGroup(uuid)).getName().toLowerCase();
|
||||
if (!primary.equals("default")) {
|
||||
user.setPermissionUnchecked(NodeFactory.make("group." + primary));
|
||||
user.setPrimaryGroup(primary);
|
||||
user.getPrimaryGroup().setStoredValue(primary);
|
||||
}
|
||||
|
||||
plugin.getUserManager().cleanup(user);
|
||||
|
||||
@@ -132,7 +132,7 @@ public class MigrationZPermissions extends SubCommand<Object> {
|
||||
plugin.getStorage().loadUser(u, username).join();
|
||||
User user = plugin.getUserManager().get(u);
|
||||
migrateEntity(user, entity, internalService.getGroups(u));
|
||||
user.setPrimaryGroup(MigrationUtils.standardizeName(service.getPlayerPrimaryGroup(u)));
|
||||
user.getPrimaryGroup().setStoredValue(MigrationUtils.standardizeName(service.getPlayerPrimaryGroup(u)));
|
||||
|
||||
plugin.getUserManager().cleanup(user);
|
||||
plugin.getStorage().saveUser(user);
|
||||
|
||||
@@ -323,7 +323,7 @@ public class VaultPermissionHook extends Permission {
|
||||
|
||||
// nothing special, just return the value.
|
||||
if (!isPgo()) {
|
||||
String g = user.getPrimaryGroup();
|
||||
String g = user.getPrimaryGroup().getValue();
|
||||
return plugin.getConfiguration().get(ConfigKeys.GROUP_NAME_REWRITES).getOrDefault(g, g);
|
||||
}
|
||||
|
||||
@@ -376,7 +376,7 @@ public class VaultPermissionHook extends Permission {
|
||||
}
|
||||
|
||||
// Fallback
|
||||
String g = user.getPrimaryGroup();
|
||||
String g = user.getPrimaryGroup().getValue();
|
||||
return plugin.getConfiguration().get(ConfigKeys.GROUP_NAME_REWRITES).getOrDefault(g, g);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,14 @@ log-notify: true
|
||||
# If "deny": the command will just fail if you try to add another node with the same expiry
|
||||
temporary-add-behaviour: deny
|
||||
|
||||
# How should LuckPerms determine a users "primary" group.
|
||||
#
|
||||
# Available Options:
|
||||
# -> stored use the value stored against the users record in the file/database
|
||||
# -> parents-by-weight just use the users most highly weighted parent
|
||||
# -> all-parents-by-weight same as above, but calculates based upon all parents inherits from both directly and indirectly
|
||||
primary-group-calculation: stored
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user