Send a more informative message when the bulkupdate command is used from in-game

This commit is contained in:
Luck 2018-08-27 18:25:57 +01:00
parent 37d4f92c33
commit 066189b486
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
2 changed files with 6 additions and 5 deletions

View File

@ -63,6 +63,11 @@ public class BulkUpdateCommand extends SingleCommand {
@Override
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, List<String> args, String label) throws CommandException {
if (!sender.isConsole()) {
Message.BULK_UPDATE_MUST_USE_CONSOLE.send(sender);
return CommandResult.NO_PERMISSION;
}
if (args.size() == 2 && args.get(0).equalsIgnoreCase("confirm")) {
String id = args.get(1);
@ -156,9 +161,4 @@ public class BulkUpdateCommand extends SingleCommand {
return CommandResult.SUCCESS;
}
@Override
public boolean isAuthorized(Sender sender) {
return sender.isConsole(); // we only want console to be able to use this command
}
}

View File

@ -332,6 +332,7 @@ public enum Message {
UNSET_META_SUCCESS("&aUnset meta key &f'{}&f'&a for &b{}&a in context {}&a.", true),
UNSET_META_TEMP_SUCCESS("&aUnset temporary meta key &f'{}&f'&a for &b{}&a in context {}&a.", true),
BULK_UPDATE_MUST_USE_CONSOLE("&cThe bulk update command can only be used from the console.", true),
BULK_UPDATE_INVALID_DATA_TYPE("&cInvalid type. Was expecting 'all', 'users' or 'groups'.", true),
BULK_UPDATE_INVALID_CONSTRAINT("&cInvalid constraint &4{}&c. Constraints should be in the format '&f<field> <comparison operator> <value>&c'.", true),
BULK_UPDATE_INVALID_COMPARISON("&cInvalid comparison operator '&4{}&c'. Expected one of the following: &f== != ~~ ~!", true),