Add config option to disable bulkupdate functionality

This commit is contained in:
Luck 2021-12-09 21:31:17 +00:00
parent 9c0874162b
commit 8cc126f711
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
10 changed files with 54 additions and 0 deletions

View File

@ -687,6 +687,12 @@ allow-invalid-usernames: false
# - If automation is needed, users should prefer using the LuckPerms API.
skip-bulkupdate-confirmation: false
# If LuckPerms should prevent bulkupdate operations.
#
# - When set to true, bulkupdate operations (the /lp bulkupdate command) will not work.
# - When set to false, bulkupdate operations will be allowed via the console.
disable-bulkupdate: false
# If LuckPerms should allow a users primary group to be removed with the 'parent remove' command.
#
# - When this happens, the plugin will set their primary group back to default.

View File

@ -589,6 +589,12 @@ allow-invalid-usernames: false
# - If automation is needed, users should prefer using the LuckPerms API.
skip-bulkupdate-confirmation: false
# If LuckPerms should prevent bulkupdate operations.
#
# - When set to true, bulkupdate operations (the /lp bulkupdate command) will not work.
# - When set to false, bulkupdate operations will be allowed via the console.
disable-bulkupdate: false
# If LuckPerms should allow a users primary group to be removed with the 'parent remove' command.
#
# - When this happens, the plugin will set their primary group back to default.

View File

@ -64,6 +64,11 @@ public class BulkUpdateCommand extends SingleCommand {
@Override
public void execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) throws CommandException {
if (plugin.getConfiguration().get(ConfigKeys.DISABLE_BULKUPDATE)) {
Message.BULK_UPDATE_DISABLED.send(sender);
return;
}
if (!sender.isConsole()) {
Message.BULK_UPDATE_MUST_USE_CONSOLE.send(sender);
return;

View File

@ -164,6 +164,11 @@ public final class ConfigKeys {
*/
public static final ConfigKey<Boolean> SKIP_BULKUPDATE_CONFIRMATION = booleanKey("skip-bulkupdate-confirmation", false);
/**
* If LuckPerms should prevent bulkupdate operations.
*/
public static final ConfigKey<Boolean> DISABLE_BULKUPDATE = booleanKey("disable-bulkupdate", false);
/**
* If LuckPerms should produce extra logging output when it handles logins.
*/

View File

@ -2662,6 +2662,13 @@ public interface Message {
.append(FULL_STOP)
);
Args0 BULK_UPDATE_DISABLED = () -> prefixed(translatable()
// "&cBulk update functionality is disabled in the configuration file."
.key("luckperms.command.bulkupdate.disabled")
.color(RED)
.append(FULL_STOP)
);
Args0 BULK_UPDATE_MUST_USE_CONSOLE = () -> prefixed(translatable()
// "&cThe bulk update command can only be used from the console."
.key("luckperms.command.bulkupdate.must-use-console")

View File

@ -324,6 +324,7 @@ luckperms.command.import.progress.operations={0}/{1} operations complete
luckperms.command.import.starting=Starting import process
luckperms.command.import.completed=COMPLETED
luckperms.command.import.duration=took {0} seconds
luckperms.command.bulkupdate.disabled=Bulk update functionality is disabled in the configuration file
luckperms.command.bulkupdate.must-use-console=The bulk update command can only be used from the console
luckperms.command.bulkupdate.invalid-data-type=Invalid type, was expecting {0}
luckperms.command.bulkupdate.invalid-constraint=Invalid constraint {0}

View File

@ -620,6 +620,12 @@ allow-invalid-usernames = false
# - If automation is needed, users should prefer using the LuckPerms API.
skip-bulkupdate-confirmation = false
# If LuckPerms should prevent bulkupdate operations.
#
# - When set to true, bulkupdate operations (the /lp bulkupdate command) will not work.
# - When set to false, bulkupdate operations will be allowed via the console.
disable-bulkupdate = false
# If LuckPerms should allow a users primary group to be removed with the 'parent remove' command.
#
# - When this happens, the plugin will set their primary group back to default.

View File

@ -631,6 +631,12 @@ allow-invalid-usernames: true
# - If automation is needed, users should prefer using the LuckPerms API.
skip-bulkupdate-confirmation: false
# If LuckPerms should prevent bulkupdate operations.
#
# - When set to true, bulkupdate operations (the /lp bulkupdate command) will not work.
# - When set to false, bulkupdate operations will be allowed via the console.
disable-bulkupdate: false
# If LuckPerms should allow a users primary group to be removed with the 'parent remove' command.
#
# - When this happens, the plugin will set their primary group back to default.

View File

@ -607,6 +607,12 @@ allow-invalid-usernames = false
# - If automation is needed, users should prefer using the LuckPerms API.
skip-bulkupdate-confirmation = false
# If LuckPerms should prevent bulkupdate operations.
#
# - When set to true, bulkupdate operations (the /lp bulkupdate command) will not work.
# - When set to false, bulkupdate operations will be allowed via the console.
disable-bulkupdate = false
# If LuckPerms should allow a users primary group to be removed with the 'parent remove' command.
#
# - When this happens, the plugin will set their primary group back to default.

View File

@ -575,6 +575,12 @@ allow-invalid-usernames: false
# - If automation is needed, users should prefer using the LuckPerms API.
skip-bulkupdate-confirmation: false
# If LuckPerms should prevent bulkupdate operations.
#
# - When set to true, bulkupdate operations (the /lp bulkupdate command) will not work.
# - When set to false, bulkupdate operations will be allowed via the console.
disable-bulkupdate: false
# If LuckPerms should allow a users primary group to be removed with the 'parent remove' command.
#
# - When this happens, the plugin will set their primary group back to default.