Add config option to prevent primary group removal (#405)
This commit is contained in:
+2
-1
@@ -79,7 +79,8 @@ public class ParentRemove extends SharedSubCommand {
|
||||
if (holder instanceof User) {
|
||||
User user = (User) holder;
|
||||
|
||||
boolean shouldPrevent = (context.isEmpty() || context.has("server", "global")) &&
|
||||
boolean shouldPrevent = plugin.getConfiguration().get(ConfigKeys.PREVENT_PRIMARY_GROUP_REMOVAL) &&
|
||||
context.isEmpty() &&
|
||||
plugin.getConfiguration().get(ConfigKeys.PRIMARY_GROUP_CALCULATION_METHOD).equals("stored") &&
|
||||
user.getPrimaryGroup().getStoredValue().equalsIgnoreCase(groupName);
|
||||
|
||||
|
||||
@@ -166,6 +166,12 @@ public class ConfigKeys {
|
||||
}
|
||||
}));
|
||||
|
||||
/**
|
||||
* If set to false, the plugin will allow a Users primary group to be removed with the
|
||||
* 'parent remove' command, and will set their primary group back to default.
|
||||
*/
|
||||
public static final ConfigKey<Boolean> PREVENT_PRIMARY_GROUP_REMOVAL = BooleanKey.of("prevent-primary-group-removal", true);
|
||||
|
||||
/**
|
||||
* If the plugin should check for "extra" permissions with users run LP commands
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user