mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-12-28 03:57:36 +01:00
Remove redundant CommandResult enum
This commit is contained in:
parent
1d465aa800
commit
9d4f278117
@ -141,7 +141,7 @@ public class CommandManager {
|
||||
return this.tabCompletions;
|
||||
}
|
||||
|
||||
public CompletableFuture<CommandResult> executeCommand(Sender sender, String label, List<String> args) {
|
||||
public CompletableFuture<Void> executeCommand(Sender sender, String label, List<String> args) {
|
||||
SchedulerAdapter scheduler = this.plugin.getBootstrap().getScheduler();
|
||||
List<String> argsCopy = new ArrayList<>(args);
|
||||
|
||||
@ -156,18 +156,17 @@ public class CommandManager {
|
||||
AtomicReference<SchedulerTask> timeoutTask = new AtomicReference<>();
|
||||
|
||||
// schedule the actual execution of the command using the command executor service
|
||||
CompletableFuture<CommandResult> future = CompletableFuture.supplyAsync(() -> {
|
||||
CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
|
||||
// set flags
|
||||
executorThread.set(Thread.currentThread());
|
||||
this.executingCommand.set(true);
|
||||
|
||||
// actually try to execute the command
|
||||
try {
|
||||
return execute(sender, label, args);
|
||||
execute(sender, label, args);
|
||||
} catch (Throwable e) {
|
||||
// catch any exception
|
||||
this.plugin.getLogger().severe("Exception whilst executing command: " + args, e);
|
||||
return null;
|
||||
} finally {
|
||||
// unset flags
|
||||
this.executingCommand.set(false);
|
||||
@ -207,7 +206,7 @@ public class CommandManager {
|
||||
return this.mainCommands.values().stream().anyMatch(c -> c.shouldDisplay() && c.isAuthorized(sender));
|
||||
}
|
||||
|
||||
private CommandResult execute(Sender sender, String label, List<String> arguments) {
|
||||
private void execute(Sender sender, String label, List<String> arguments) {
|
||||
applyConvenienceAliases(arguments, true);
|
||||
|
||||
// Handle no arguments
|
||||
@ -223,7 +222,7 @@ public class CommandManager {
|
||||
|
||||
if (hasPermissionForAny(sender)) {
|
||||
Message.VIEW_AVAILABLE_COMMANDS_PROMPT.send(sender, label);
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
Collection<? extends Group> groups = this.plugin.getGroupManager().getAll().values();
|
||||
@ -232,7 +231,7 @@ public class CommandManager {
|
||||
} else {
|
||||
Message.NO_PERMISSION_FOR_SUBCOMMANDS.send(sender);
|
||||
}
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
// Look for the main command.
|
||||
@ -241,13 +240,13 @@ public class CommandManager {
|
||||
// Main command not found
|
||||
if (main == null) {
|
||||
sendCommandUsage(sender, label);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
// Check the Sender has permission to use the main command.
|
||||
if (!main.isAuthorized(sender)) {
|
||||
sendCommandUsage(sender, label);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
arguments.remove(0); // remove the main command arg.
|
||||
@ -255,21 +254,17 @@ public class CommandManager {
|
||||
// Check the correct number of args were given for the main command
|
||||
if (main.getArgumentCheck().test(arguments.size())) {
|
||||
main.sendDetailedUsage(sender, label);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to execute the command.
|
||||
CommandResult result;
|
||||
try {
|
||||
result = main.execute(this.plugin, sender, null, new ArgumentList(arguments), label);
|
||||
main.execute(this.plugin, sender, null, new ArgumentList(arguments), label);
|
||||
} catch (CommandException e) {
|
||||
result = e.handle(sender, label, main);
|
||||
e.handle(sender, label, main);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
result = CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<String> tabCompleteCommand(Sender sender, List<String> arguments) {
|
||||
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.common.command;
|
||||
|
||||
/**
|
||||
* Represents the result of a commands execution
|
||||
*/
|
||||
public enum CommandResult {
|
||||
SUCCESS(true),
|
||||
FAILURE(false),
|
||||
|
||||
LOADING_ERROR(false),
|
||||
STATE_ERROR(false),
|
||||
INVALID_ARGS(false),
|
||||
NO_PERMISSION(false);
|
||||
|
||||
private final boolean wasSuccess;
|
||||
|
||||
CommandResult(boolean wasSuccess) {
|
||||
this.wasSuccess = wasSuccess;
|
||||
}
|
||||
|
||||
public boolean wasFailure() {
|
||||
return !this.wasSuccess;
|
||||
}
|
||||
|
||||
}
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.command.abstraction;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.Argument;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -148,7 +147,7 @@ public abstract class Command<T> {
|
||||
}
|
||||
|
||||
// Main execution method for the command.
|
||||
public abstract CommandResult execute(LuckPermsPlugin plugin, Sender sender, T target, ArgumentList args, String label) throws CommandException;
|
||||
public abstract void execute(LuckPermsPlugin plugin, Sender sender, T target, ArgumentList args, String label) throws CommandException;
|
||||
|
||||
// Tab completion method - default implementation is provided as some commands do not provide tab completions.
|
||||
public List<String> tabComplete(LuckPermsPlugin plugin, Sender sender, ArgumentList args) {
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.command.abstraction;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.sender.Sender;
|
||||
|
||||
/**
|
||||
@ -33,14 +32,14 @@ import me.lucko.luckperms.common.sender.Sender;
|
||||
*/
|
||||
public abstract class CommandException extends Exception {
|
||||
|
||||
protected abstract CommandResult handle(Sender sender);
|
||||
protected abstract void handle(Sender sender);
|
||||
|
||||
public CommandResult handle(Sender sender, String label, Command<?> command) {
|
||||
return handle(sender);
|
||||
public void handle(Sender sender, String label, Command<?> command) {
|
||||
handle(sender);
|
||||
}
|
||||
|
||||
public CommandResult handle(Sender sender, GenericChildCommand command) {
|
||||
return handle(sender);
|
||||
public void handle(Sender sender, GenericChildCommand command) {
|
||||
handle(sender);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.command.abstraction;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.Argument;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -77,7 +76,7 @@ public abstract class GenericChildCommand {
|
||||
this.argumentCheck = argumentCheck;
|
||||
}
|
||||
|
||||
public abstract CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException;
|
||||
public abstract void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException;
|
||||
|
||||
public List<String> tabComplete(LuckPermsPlugin plugin, Sender sender, ArgumentList args) {
|
||||
return Collections.emptyList();
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.command.abstraction;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
import me.lucko.luckperms.common.command.tabcomplete.CompletionSupplier;
|
||||
import me.lucko.luckperms.common.command.tabcomplete.TabCompleter;
|
||||
@ -59,10 +58,10 @@ public class GenericParentCommand<T extends PermissionHolder> extends ChildComma
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, T holder, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, T holder, ArgumentList args, String label) {
|
||||
if (args.isEmpty()) {
|
||||
sendUsageDetailed(sender, label);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
GenericChildCommand sub = this.children.stream()
|
||||
@ -72,26 +71,24 @@ public class GenericParentCommand<T extends PermissionHolder> extends ChildComma
|
||||
|
||||
if (sub == null) {
|
||||
Message.COMMAND_NOT_RECOGNISED.send(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sub.isAuthorized(sender, this.type)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sub.getArgumentCheck().test(args.size() - 1)) {
|
||||
sub.sendDetailedUsage(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
CommandResult result;
|
||||
try {
|
||||
result = sub.execute(plugin, sender, holder, args.subList(1, args.size()), label, this.type == HolderType.USER ? sub.getUserPermission() : sub.getGroupPermission());
|
||||
sub.execute(plugin, sender, holder, args.subList(1, args.size()), label, this.type == HolderType.USER ? sub.getUserPermission() : sub.getGroupPermission());
|
||||
} catch (CommandException e) {
|
||||
result = e.handle(sender, sub);
|
||||
e.handle(sender, sub);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.command.abstraction;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
import me.lucko.luckperms.common.command.tabcomplete.CompletionSupplier;
|
||||
import me.lucko.luckperms.common.command.tabcomplete.TabCompleter;
|
||||
@ -60,11 +59,11 @@ public abstract class ParentCommand<T, I> extends Command<Void> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Void ignored, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Void ignored, ArgumentList args, String label) {
|
||||
// check if required argument and/or subcommand is missing
|
||||
if (args.size() < this.type.minArgs) {
|
||||
sendUsage(sender, label);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
Command<T> sub = getChildren().stream()
|
||||
@ -74,17 +73,17 @@ public abstract class ParentCommand<T, I> extends Command<Void> {
|
||||
|
||||
if (sub == null) {
|
||||
Message.COMMAND_NOT_RECOGNISED.send(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sub.isAuthorized(sender)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sub.getArgumentCheck().test(args.size() - this.type.minArgs)) {
|
||||
sub.sendDetailedUsage(sender, label);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
final String targetArgument = args.get(0);
|
||||
@ -92,7 +91,7 @@ public abstract class ParentCommand<T, I> extends Command<Void> {
|
||||
if (this.type == Type.TAKES_ARGUMENT_FOR_TARGET) {
|
||||
targetId = parseTarget(targetArgument, plugin, sender);
|
||||
if (targetId == null) {
|
||||
return CommandResult.LOADING_ERROR;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,18 +100,16 @@ public abstract class ParentCommand<T, I> extends Command<Void> {
|
||||
try {
|
||||
T target = getTarget(targetId, plugin, sender);
|
||||
if (target == null) {
|
||||
return CommandResult.LOADING_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
CommandResult result;
|
||||
try {
|
||||
result = sub.execute(plugin, sender, target, args.subList(this.type.minArgs, args.size()), label);
|
||||
sub.execute(plugin, sender, target, args.subList(this.type.minArgs, args.size()), label);
|
||||
} catch (CommandException e) {
|
||||
result = e.handle(sender, label, sub);
|
||||
e.handle(sender, label, sub);
|
||||
}
|
||||
|
||||
cleanup(target, plugin);
|
||||
return result;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.command.abstraction;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.Argument;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -52,11 +51,11 @@ public abstract class SingleCommand extends Command<Void> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Void ignored, ArgumentList args, String label) throws CommandException {
|
||||
return execute(plugin, sender, args, label);
|
||||
public final void execute(LuckPermsPlugin plugin, Sender sender, Void ignored, ArgumentList args, String label) throws CommandException {
|
||||
execute(plugin, sender, args, label);
|
||||
}
|
||||
|
||||
public abstract CommandResult execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) throws CommandException;
|
||||
public abstract void execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) throws CommandException;
|
||||
|
||||
@Override
|
||||
public void sendUsage(Sender sender, String label) {
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.command.utils;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.Command;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
@ -36,28 +35,25 @@ public abstract class ArgumentException extends CommandException {
|
||||
|
||||
public static class DetailedUsage extends ArgumentException {
|
||||
@Override
|
||||
protected CommandResult handle(Sender sender) {
|
||||
protected void handle(Sender sender) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult handle(Sender sender, String label, Command<?> command) {
|
||||
public void handle(Sender sender, String label, Command<?> command) {
|
||||
command.sendDetailedUsage(sender, label);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult handle(Sender sender, GenericChildCommand command) {
|
||||
public void handle(Sender sender, GenericChildCommand command) {
|
||||
command.sendDetailedUsage(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
}
|
||||
|
||||
public static class PastDate extends ArgumentException {
|
||||
@Override
|
||||
protected CommandResult handle(Sender sender) {
|
||||
protected void handle(Sender sender) {
|
||||
Message.PAST_DATE_ERROR.send(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,9 +65,8 @@ public abstract class ArgumentException extends CommandException {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandResult handle(Sender sender) {
|
||||
protected void handle(Sender sender) {
|
||||
Message.ILLEGAL_DATE_ERROR.send(sender, this.invalidDate);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,9 +78,8 @@ public abstract class ArgumentException extends CommandException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult handle(Sender sender) {
|
||||
public void handle(Sender sender) {
|
||||
Message.META_INVALID_PRIORITY.send(sender, this.invalidPriority);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.meta;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -79,10 +78,10 @@ public class MetaAddChatMeta extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
int priority = args.getPriority(0);
|
||||
@ -92,7 +91,7 @@ public class MetaAddChatMeta extends GenericChildCommand {
|
||||
if (ArgumentPermissions.checkContext(plugin, sender, permission, context) ||
|
||||
ArgumentPermissions.checkGroup(plugin, sender, target, context)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
DataMutateResult result = target.setNode(DataType.NORMAL, this.type.builder(meta, priority).withContext(context).build(), true);
|
||||
@ -104,10 +103,8 @@ public class MetaAddChatMeta extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.ALREADY_HAS_CHAT_META.send(sender, target, this.type, meta, priority, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.meta;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -82,10 +81,10 @@ public class MetaAddTempChatMeta extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
int priority = args.getPriority(0);
|
||||
@ -97,7 +96,7 @@ public class MetaAddTempChatMeta extends GenericChildCommand {
|
||||
if (ArgumentPermissions.checkContext(plugin, sender, permission, context) ||
|
||||
ArgumentPermissions.checkGroup(plugin, sender, target, context)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
DataMutateResult.WithMergedNode result = target.setNode(DataType.NORMAL, this.type.builder(meta, priority).expiry(duration).withContext(context).build(), modifier);
|
||||
@ -112,10 +111,8 @@ public class MetaAddTempChatMeta extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.ALREADY_HAS_TEMP_CHAT_META.send(sender, target, this.type, meta, priority, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.meta;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -54,10 +53,10 @@ public class MetaClear extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
NodeType<?> type = null;
|
||||
@ -95,7 +94,7 @@ public class MetaClear extends GenericChildCommand {
|
||||
if (ArgumentPermissions.checkContext(plugin, sender, permission, context) ||
|
||||
ArgumentPermissions.checkGroup(plugin, sender, target, context)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
if (context.isEmpty()) {
|
||||
@ -112,7 +111,6 @@ public class MetaClear extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,7 +27,6 @@ package me.lucko.luckperms.common.commands.generic.meta;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -61,10 +60,10 @@ public class MetaInfo extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) {
|
||||
if (ArgumentPermissions.checkViewPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
SortedSet<Map.Entry<Integer, PrefixNode>> prefixes = new TreeSet<>(MetaComparator.INSTANCE.reversed());
|
||||
@ -110,8 +109,6 @@ public class MetaInfo extends GenericChildCommand {
|
||||
Message.META_ENTRY.send(sender, node, target, label);
|
||||
}
|
||||
}
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
private static final class MetaComparator implements Comparator<Map.Entry<Integer, ? extends ChatMetaNode<?, ?>>> {
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.meta;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -79,10 +78,10 @@ public class MetaRemoveChatMeta extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
int priority = args.getPriority(0);
|
||||
@ -92,7 +91,7 @@ public class MetaRemoveChatMeta extends GenericChildCommand {
|
||||
if (ArgumentPermissions.checkContext(plugin, sender, permission, context) ||
|
||||
ArgumentPermissions.checkGroup(plugin, sender, target, context)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle bulk removal
|
||||
@ -105,7 +104,7 @@ public class MetaRemoveChatMeta extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
DataMutateResult result = target.unsetNode(DataType.NORMAL, this.type.builder(meta, priority).withContext(context).build());
|
||||
@ -118,10 +117,8 @@ public class MetaRemoveChatMeta extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.DOES_NOT_HAVE_CHAT_META.send(sender, target, this.type, meta, priority, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.meta;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -79,10 +78,10 @@ public class MetaRemoveTempChatMeta extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
int priority = args.getPriority(0);
|
||||
@ -92,7 +91,7 @@ public class MetaRemoveTempChatMeta extends GenericChildCommand {
|
||||
if (ArgumentPermissions.checkContext(plugin, sender, permission, context) ||
|
||||
ArgumentPermissions.checkGroup(plugin, sender, target, context)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle bulk removal
|
||||
@ -105,7 +104,7 @@ public class MetaRemoveTempChatMeta extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
DataMutateResult result = target.unsetNode(DataType.NORMAL, this.type.builder(meta, priority).expiry(10L).withContext(context).build());
|
||||
@ -118,10 +117,8 @@ public class MetaRemoveTempChatMeta extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.DOES_NOT_HAVE_TEMP_CHAT_META.send(sender, target, this.type, meta, priority, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.meta;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -57,10 +56,10 @@ public class MetaSet extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String key = args.get(0);
|
||||
@ -71,14 +70,14 @@ public class MetaSet extends GenericChildCommand {
|
||||
ArgumentPermissions.checkGroup(plugin, sender, target, context) ||
|
||||
ArgumentPermissions.checkArguments(plugin, sender, permission, key)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
Node node = Meta.builder(key, value).withContext(context).build();
|
||||
|
||||
if (target.hasNode(DataType.NORMAL, node, NodeEqualityPredicate.IGNORE_EXPIRY_TIME_AND_VALUE).asBoolean()) {
|
||||
Message.ALREADY_HAS_META.send(sender, target, key, value, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
target.removeIf(DataType.NORMAL, context, NodeType.META.predicate(n -> !n.hasExpiry() && n.getMetaKey().equalsIgnoreCase(key)), false);
|
||||
@ -91,7 +90,6 @@ public class MetaSet extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,7 +27,6 @@ package me.lucko.luckperms.common.commands.generic.meta;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.cacheddata.type.MetaAccumulator;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -83,10 +82,10 @@ public class MetaSetChatMeta extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
int priority = args.getIntOrDefault(0, Integer.MIN_VALUE);
|
||||
@ -101,7 +100,7 @@ public class MetaSetChatMeta extends GenericChildCommand {
|
||||
// priority was defined, meta should be at index 1, contexts at index 2
|
||||
if (args.size() <= 1) {
|
||||
sendDetailedUsage(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
meta = args.get(1);
|
||||
@ -111,7 +110,7 @@ public class MetaSetChatMeta extends GenericChildCommand {
|
||||
if (ArgumentPermissions.checkContext(plugin, sender, permission, context) ||
|
||||
ArgumentPermissions.checkGroup(plugin, sender, target, context)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
// remove all other prefixes/suffixes set in these contexts
|
||||
@ -139,10 +138,8 @@ public class MetaSetChatMeta extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.ALREADY_HAS_CHAT_META.send(sender, target, this.type, meta, priority, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.meta;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -60,10 +59,10 @@ public class MetaSetTemp extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String key = args.get(0);
|
||||
@ -76,7 +75,7 @@ public class MetaSetTemp extends GenericChildCommand {
|
||||
ArgumentPermissions.checkGroup(plugin, sender, target, context) ||
|
||||
ArgumentPermissions.checkArguments(plugin, sender, permission, key)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
Node node = Meta.builder(key, value).withContext(context).expiry(duration).build();
|
||||
@ -93,10 +92,8 @@ public class MetaSetTemp extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.ALREADY_HAS_TEMP_META.send(sender, target, key, value, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,6 @@ package me.lucko.luckperms.common.commands.generic.meta;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.cacheddata.type.MetaAccumulator;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -86,10 +85,10 @@ public class MetaSetTempChatMeta extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
int priority = args.getIntOrDefault(0, Integer.MIN_VALUE);
|
||||
@ -108,7 +107,7 @@ public class MetaSetTempChatMeta extends GenericChildCommand {
|
||||
// priority was defined, meta should be at index 1, duration at index 2
|
||||
if (args.size() <= 2) {
|
||||
sendDetailedUsage(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
meta = args.get(1);
|
||||
@ -120,7 +119,7 @@ public class MetaSetTempChatMeta extends GenericChildCommand {
|
||||
if (ArgumentPermissions.checkContext(plugin, sender, permission, context) ||
|
||||
ArgumentPermissions.checkGroup(plugin, sender, target, context)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
// remove all other prefixes/suffixes set in these contexts
|
||||
@ -151,10 +150,8 @@ public class MetaSetTempChatMeta extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.ALREADY_HAS_TEMP_CHAT_META.send(sender, target, this.type, meta, priority, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.meta;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -54,10 +53,10 @@ public class MetaUnset extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String key = args.get(0);
|
||||
@ -67,7 +66,7 @@ public class MetaUnset extends GenericChildCommand {
|
||||
ArgumentPermissions.checkGroup(plugin, sender, target, context) ||
|
||||
ArgumentPermissions.checkArguments(plugin, sender, permission, key)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.removeIf(DataType.NORMAL, context, NodeType.META.predicate(n -> !n.hasExpiry() && n.getMetaKey().equalsIgnoreCase(key)), false)) {
|
||||
@ -78,10 +77,8 @@ public class MetaUnset extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.DOESNT_HAVE_META.send(sender, target, key, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.meta;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -54,10 +53,10 @@ public class MetaUnsetTemp extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String key = args.get(0);
|
||||
@ -67,7 +66,7 @@ public class MetaUnsetTemp extends GenericChildCommand {
|
||||
ArgumentPermissions.checkGroup(plugin, sender, target, context) ||
|
||||
ArgumentPermissions.checkArguments(plugin, sender, permission, key)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.removeIf(DataType.NORMAL, context, NodeType.META.predicate(n -> n.hasExpiry() && n.getMetaKey().equalsIgnoreCase(key)), false)) {
|
||||
@ -78,10 +77,8 @@ public class MetaUnsetTemp extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.DOESNT_HAVE_TEMP_META.send(sender, target, key, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.other;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -54,10 +53,10 @@ public class HolderClear<T extends PermissionHolder> extends ChildCommand<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, T target, ArgumentList args, String label) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, T target, ArgumentList args, String label) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, getPermission().get(), target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
int before = target.normalData().size();
|
||||
@ -67,7 +66,7 @@ public class HolderClear<T extends PermissionHolder> extends ChildCommand<T> {
|
||||
if (ArgumentPermissions.checkContext(plugin, sender, getPermission().get(), context) ||
|
||||
ArgumentPermissions.checkGroup(plugin, sender, target, context)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
if (context.isEmpty()) {
|
||||
@ -84,7 +83,6 @@ public class HolderClear<T extends PermissionHolder> extends ChildCommand<T> {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.generic.other;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -56,10 +55,10 @@ public class HolderEditor<T extends PermissionHolder> extends ChildCommand<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, T target, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, T target, ArgumentList args, String label) {
|
||||
if (ArgumentPermissions.checkViewPerms(plugin, sender, getPermission().get(), target) || ArgumentPermissions.checkGroup(plugin, sender, target, ImmutableContextSetImpl.EMPTY)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
List<PermissionHolder> holders = new ArrayList<>();
|
||||
@ -80,12 +79,12 @@ public class HolderEditor<T extends PermissionHolder> extends ChildCommand<T> {
|
||||
// they don't have perms to view any of them
|
||||
if (holders.isEmpty()) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
Message.EDITOR_START.send(sender);
|
||||
|
||||
return WebEditorRequest.generate(holders, Collections.emptyList(), sender, label, plugin)
|
||||
WebEditorRequest.generate(holders, Collections.emptyList(), sender, label, plugin)
|
||||
.createSession(plugin, sender);
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,6 @@ package me.lucko.luckperms.common.commands.generic.other;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -58,10 +57,10 @@ public class HolderShowTracks<T extends PermissionHolder> extends ChildCommand<T
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, T target, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, T target, ArgumentList args, String label) {
|
||||
if (ArgumentPermissions.checkViewPerms(plugin, sender, getPermission().get(), target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -69,7 +68,7 @@ public class HolderShowTracks<T extends PermissionHolder> extends ChildCommand<T
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().warn("Error whilst loading tracks", e);
|
||||
Message.TRACKS_LOAD_ERROR.send(sender);
|
||||
return CommandResult.LOADING_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
List<Map.Entry<Track, Component>> lines = new ArrayList<>();
|
||||
@ -111,13 +110,12 @@ public class HolderShowTracks<T extends PermissionHolder> extends ChildCommand<T
|
||||
|
||||
if (lines.isEmpty()) {
|
||||
Message.LIST_TRACKS_EMPTY.send(sender, target);
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
Message.LIST_TRACKS.send(sender, target);
|
||||
for (Map.Entry<Track, Component> line : lines) {
|
||||
Message.LIST_TRACKS_ENTRY.send(sender, line.getKey().getName(), line.getValue());
|
||||
}
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.parent;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -57,10 +56,10 @@ public class ParentAdd extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String groupName = args.getLowercase(0, DataConstraints.GROUP_NAME_TEST);
|
||||
@ -68,7 +67,7 @@ public class ParentAdd extends GenericChildCommand {
|
||||
|
||||
Group group = StorageAssistant.loadGroup(groupName, sender, plugin, false);
|
||||
if (group == null) {
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ArgumentPermissions.checkContext(plugin, sender, permission, context) ||
|
||||
@ -76,7 +75,7 @@ public class ParentAdd extends GenericChildCommand {
|
||||
ArgumentPermissions.checkGroup(plugin, sender, group, context) ||
|
||||
ArgumentPermissions.checkArguments(plugin, sender, permission, group.getName())) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
DataMutateResult result = target.setNode(DataType.NORMAL, Inheritance.builder(group.getName()).withContext(context).build(), true);
|
||||
@ -89,10 +88,8 @@ public class ParentAdd extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.ALREADY_INHERITS.send(sender, target, group, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.parent;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -60,10 +59,10 @@ public class ParentAddTemp extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String groupName = args.getLowercase(0, DataConstraints.GROUP_NAME_TEST);
|
||||
@ -73,7 +72,7 @@ public class ParentAddTemp extends GenericChildCommand {
|
||||
|
||||
Group group = StorageAssistant.loadGroup(groupName, sender, plugin, false);
|
||||
if (group == null) {
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ArgumentPermissions.checkContext(plugin, sender, permission, context) ||
|
||||
@ -81,12 +80,12 @@ public class ParentAddTemp extends GenericChildCommand {
|
||||
ArgumentPermissions.checkGroup(plugin, sender, group, context) ||
|
||||
ArgumentPermissions.checkArguments(plugin, sender, permission, group.getName())) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
if (group.getName().equalsIgnoreCase(target.getObjectName())) {
|
||||
Message.ALREADY_TEMP_INHERITS.send(sender, target, group, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
DataMutateResult.WithMergedNode result = target.setNode(DataType.NORMAL, Inheritance.builder(group.getName()).expiry(duration).withContext(context).build(), modifier);
|
||||
@ -100,10 +99,8 @@ public class ParentAddTemp extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.ALREADY_TEMP_INHERITS.send(sender, target, group, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.parent;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -54,10 +53,10 @@ public class ParentClear extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
int before = target.normalData().size();
|
||||
@ -66,7 +65,7 @@ public class ParentClear extends GenericChildCommand {
|
||||
|
||||
if (ArgumentPermissions.checkContext(plugin, sender, permission, context) || ArgumentPermissions.checkGroup(plugin, sender, target, context)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
if (context.isEmpty()) {
|
||||
@ -83,7 +82,6 @@ public class ParentClear extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.parent;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -58,26 +57,26 @@ public class ParentClearTrack extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
final String trackName = args.get(0).toLowerCase();
|
||||
if (!DataConstraints.TRACK_NAME_TEST.test(trackName)) {
|
||||
Message.TRACK_INVALID_ENTRY.send(sender, trackName);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
Track track = StorageAssistant.loadTrack(trackName, sender, plugin);
|
||||
if (track == null) {
|
||||
return CommandResult.LOADING_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (track.getSize() <= 1) {
|
||||
Message.TRACK_EMPTY.send(sender, track.getName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
int before = target.normalData().size();
|
||||
@ -88,7 +87,7 @@ public class ParentClearTrack extends GenericChildCommand {
|
||||
ArgumentPermissions.checkGroup(plugin, sender, target, context) ||
|
||||
ArgumentPermissions.checkArguments(plugin, sender, permission, track.getName())) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
target.removeIf(DataType.NORMAL, context.isEmpty() ? null : context, NodeType.INHERITANCE.predicate(n -> track.containsGroup(n.getGroupName())), false);
|
||||
@ -105,7 +104,6 @@ public class ParentClearTrack extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.generic.parent;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -55,10 +54,10 @@ public class ParentInfo extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) {
|
||||
if (ArgumentPermissions.checkViewPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
int page = args.getIntOrDefault(0, 1);
|
||||
@ -74,7 +73,7 @@ public class ParentInfo extends GenericChildCommand {
|
||||
// handle empty
|
||||
if (nodes.isEmpty()) {
|
||||
Message.PARENT_INFO_NO_DATA.send(sender, target);
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
// sort the list alphabetically instead
|
||||
@ -108,8 +107,6 @@ public class ParentInfo extends GenericChildCommand {
|
||||
Message.PARENT_INFO_NODE_ENTRY.send(sender, node, target, label);
|
||||
}
|
||||
}
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
private static final Comparator<InheritanceNode> ALPHABETICAL_NODE_COMPARATOR = (o1, o2) -> {
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.parent;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -61,10 +60,10 @@ public class ParentRemove extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String groupName = args.getLowercase(0, DataConstraints.GROUP_NAME_TEST_ALLOW_SPACE);
|
||||
@ -75,7 +74,7 @@ public class ParentRemove extends GenericChildCommand {
|
||||
ArgumentPermissions.checkGroup(plugin, sender, groupName, context) ||
|
||||
ArgumentPermissions.checkArguments(plugin, sender, permission, groupName)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.getType() == HolderType.USER) {
|
||||
@ -88,7 +87,7 @@ public class ParentRemove extends GenericChildCommand {
|
||||
|
||||
if (shouldPrevent) {
|
||||
Message.USER_REMOVEGROUP_ERROR_PRIMARY.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,10 +104,8 @@ public class ParentRemove extends GenericChildCommand {
|
||||
}
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.DOES_NOT_INHERIT.send(sender, target, Component.text(groupName), context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.parent;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -59,10 +58,10 @@ public class ParentRemoveTemp extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String groupName = args.getLowercase(0, DataConstraints.GROUP_NAME_TEST_ALLOW_SPACE);
|
||||
@ -75,7 +74,7 @@ public class ParentRemoveTemp extends GenericChildCommand {
|
||||
ArgumentPermissions.checkGroup(plugin, sender, groupName, context) ||
|
||||
ArgumentPermissions.checkArguments(plugin, sender, permission, groupName)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
DataMutateResult.WithMergedNode result = target.unsetNode(DataType.NORMAL, Inheritance.builder(groupName).expiry(10L).withContext(context).build(), duration);
|
||||
@ -97,10 +96,8 @@ public class ParentRemoveTemp extends GenericChildCommand {
|
||||
}
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.DOES_NOT_TEMP_INHERIT.send(sender, target, Component.text(groupName), context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.parent;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -59,10 +58,10 @@ public class ParentSet extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String groupName = args.getLowercase(0, DataConstraints.GROUP_NAME_TEST);
|
||||
@ -70,7 +69,7 @@ public class ParentSet extends GenericChildCommand {
|
||||
|
||||
Group group = StorageAssistant.loadGroup(groupName, sender, plugin, false);
|
||||
if (group == null) {
|
||||
return CommandResult.LOADING_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ArgumentPermissions.checkContext(plugin, sender, permission, context) ||
|
||||
@ -78,7 +77,7 @@ public class ParentSet extends GenericChildCommand {
|
||||
ArgumentPermissions.checkGroup(plugin, sender, group, context) ||
|
||||
ArgumentPermissions.checkArguments(plugin, sender, permission, group.getName())) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
target.removeIf(DataType.NORMAL, context, NodeType.INHERITANCE::matches, false);
|
||||
@ -94,7 +93,6 @@ public class ParentSet extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.parent;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -58,26 +57,26 @@ public class ParentSetTrack extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
final String trackName = args.get(0).toLowerCase();
|
||||
if (!DataConstraints.TRACK_NAME_TEST.test(trackName)) {
|
||||
Message.TRACK_INVALID_ENTRY.send(sender, trackName);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
Track track = StorageAssistant.loadTrack(trackName, sender, plugin);
|
||||
if (track == null) {
|
||||
return CommandResult.LOADING_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (track.getSize() <= 1) {
|
||||
Message.TRACK_EMPTY.send(sender, track.getName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
int index = args.getIntOrDefault(1, -1);
|
||||
@ -86,14 +85,14 @@ public class ParentSetTrack extends GenericChildCommand {
|
||||
List<String> trackGroups = track.getGroups();
|
||||
if (index - 1 >= trackGroups.size()) {
|
||||
Message.DOES_NOT_EXIST.send(sender, String.valueOf(index));
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
groupName = track.getGroups().get(index - 1);
|
||||
} else {
|
||||
groupName = args.getLowercase(1, DataConstraints.GROUP_NAME_TEST);
|
||||
if (!track.containsGroup(groupName)) {
|
||||
Message.TRACK_DOES_NOT_CONTAIN.send(sender, track.getName(), groupName);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,7 +100,7 @@ public class ParentSetTrack extends GenericChildCommand {
|
||||
|
||||
Group group = StorageAssistant.loadGroup(groupName, sender, plugin, false);
|
||||
if (group == null) {
|
||||
return CommandResult.LOADING_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ArgumentPermissions.checkContext(plugin, sender, permission, context) ||
|
||||
@ -109,7 +108,7 @@ public class ParentSetTrack extends GenericChildCommand {
|
||||
ArgumentPermissions.checkGroup(plugin, sender, group, context) ||
|
||||
ArgumentPermissions.checkArguments(plugin, sender, permission, track.getName(), group.getName())) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
target.removeIf(DataType.NORMAL, context, NodeType.INHERITANCE.predicate(n -> track.containsGroup(n.getGroupName())), false);
|
||||
@ -122,7 +121,6 @@ public class ParentSetTrack extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.parent;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -59,7 +58,7 @@ public class UserSwitchPrimaryGroup extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) {
|
||||
// cast to user
|
||||
// although this command is build as a sharedsubcommand,
|
||||
// it is only added to the listings for users.
|
||||
@ -67,7 +66,7 @@ public class UserSwitchPrimaryGroup extends GenericChildCommand {
|
||||
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, user)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String opt = plugin.getConfiguration().get(ConfigKeys.PRIMARY_GROUP_CALCULATION_METHOD);
|
||||
@ -78,7 +77,7 @@ public class UserSwitchPrimaryGroup extends GenericChildCommand {
|
||||
Group group = plugin.getGroupManager().getIfLoaded(args.get(0).toLowerCase());
|
||||
if (group == null) {
|
||||
Message.DOES_NOT_EXIST.send(sender, args.get(0).toLowerCase());
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ArgumentPermissions.checkContext(plugin, sender, permission, ImmutableContextSetImpl.EMPTY) ||
|
||||
@ -86,12 +85,12 @@ public class UserSwitchPrimaryGroup extends GenericChildCommand {
|
||||
ArgumentPermissions.checkGroup(plugin, sender, group, ImmutableContextSetImpl.EMPTY) ||
|
||||
ArgumentPermissions.checkArguments(plugin, sender, permission, group.getName())) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
if (user.getPrimaryGroup().getStoredValue().orElse(GroupManager.DEFAULT_GROUP_NAME).equalsIgnoreCase(group.getName())) {
|
||||
Message.USER_PRIMARYGROUP_ERROR_ALREADYHAS.send(sender, user, group);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
Node node = Inheritance.builder(group.getName()).build();
|
||||
@ -108,7 +107,6 @@ public class UserSwitchPrimaryGroup extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(user, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,7 +27,6 @@ package me.lucko.luckperms.common.commands.generic.permission;
|
||||
|
||||
import me.lucko.luckperms.common.calculator.processor.WildcardProcessor;
|
||||
import me.lucko.luckperms.common.calculator.result.TristateResult;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -66,10 +65,10 @@ public class PermissionCheck extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkViewPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String node = args.get(0);
|
||||
@ -149,8 +148,6 @@ public class PermissionCheck extends GenericChildCommand {
|
||||
|
||||
// send results
|
||||
Message.PERMISSION_CHECK_RESULT.send(sender, node, result, processor, cause, context);
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.permission;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -54,10 +53,10 @@ public class PermissionClear extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
int before = target.normalData().size();
|
||||
@ -67,7 +66,7 @@ public class PermissionClear extends GenericChildCommand {
|
||||
if (ArgumentPermissions.checkContext(plugin, sender, permission, context) ||
|
||||
ArgumentPermissions.checkGroup(plugin, sender, target, context)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
target.removeIf(DataType.NORMAL, context.isEmpty() ? null : context, NodeType.PERMISSION::matches, false);
|
||||
@ -80,7 +79,6 @@ public class PermissionClear extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.generic.permission;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -55,10 +54,10 @@ public class PermissionInfo extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) {
|
||||
if (ArgumentPermissions.checkViewPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
int page = args.getIntOrDefault(0, 1);
|
||||
@ -74,7 +73,7 @@ public class PermissionInfo extends GenericChildCommand {
|
||||
// handle empty
|
||||
if (nodes.isEmpty()) {
|
||||
Message.PERMISSION_INFO_NO_DATA.send(sender, target);
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
// sort the list alphabetically instead
|
||||
@ -108,8 +107,6 @@ public class PermissionInfo extends GenericChildCommand {
|
||||
Message.PERMISSION_INFO_NODE_ENTRY.send(sender, node, target, label);
|
||||
}
|
||||
}
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
private static final Comparator<Node> ALPHABETICAL_NODE_COMPARATOR = (o1, o2) -> {
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.permission;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -57,10 +56,10 @@ public class PermissionSet extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String node = args.get(0);
|
||||
@ -75,7 +74,7 @@ public class PermissionSet extends GenericChildCommand {
|
||||
ArgumentPermissions.checkGroup(plugin, sender, target, context) ||
|
||||
ArgumentPermissions.checkArguments(plugin, sender, permission, node)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
Node builtNode = NodeBuilders.determineMostApplicable(node).value(value).withContext(context).build();
|
||||
@ -83,7 +82,7 @@ public class PermissionSet extends GenericChildCommand {
|
||||
if (builtNode instanceof InheritanceNode) {
|
||||
if (ArgumentPermissions.checkGroup(plugin, sender, ((InheritanceNode) builtNode).getGroupName(), context)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,10 +96,8 @@ public class PermissionSet extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.ALREADY_HASPERMISSION.send(sender, target, node, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.permission;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -60,10 +59,10 @@ public class PermissionSetTemp extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String node = args.get(0);
|
||||
@ -80,7 +79,7 @@ public class PermissionSetTemp extends GenericChildCommand {
|
||||
ArgumentPermissions.checkGroup(plugin, sender, target, context) ||
|
||||
ArgumentPermissions.checkArguments(plugin, sender, permission, node)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
Node builtNode = NodeBuilders.determineMostApplicable(node).value(value).withContext(context).expiry(duration).build();
|
||||
@ -88,7 +87,7 @@ public class PermissionSetTemp extends GenericChildCommand {
|
||||
if (builtNode instanceof InheritanceNode) {
|
||||
if (ArgumentPermissions.checkGroup(plugin, sender, ((InheritanceNode) builtNode).getGroupName(), context)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,10 +102,8 @@ public class PermissionSetTemp extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.ALREADY_HAS_TEMP_PERMISSION.send(sender, target, node, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.permission;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -57,10 +56,10 @@ public class PermissionUnset extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String node = args.get(0);
|
||||
@ -74,7 +73,7 @@ public class PermissionUnset extends GenericChildCommand {
|
||||
ArgumentPermissions.checkGroup(plugin, sender, target, context) ||
|
||||
ArgumentPermissions.checkArguments(plugin, sender, permission, node)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
Node builtNode = NodeBuilders.determineMostApplicable(node).withContext(context).build();
|
||||
@ -82,7 +81,7 @@ public class PermissionUnset extends GenericChildCommand {
|
||||
if (builtNode instanceof InheritanceNode) {
|
||||
if (ArgumentPermissions.checkGroup(plugin, sender, ((InheritanceNode) builtNode).getGroupName(), context)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,10 +95,8 @@ public class PermissionUnset extends GenericChildCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.DOES_NOT_HAVE_PERMISSION.send(sender, target, node, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.generic.permission;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.GenericChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -58,10 +57,10 @@ public class PermissionUnsetTemp extends GenericChildCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String node = args.get(0);
|
||||
@ -77,7 +76,7 @@ public class PermissionUnsetTemp extends GenericChildCommand {
|
||||
ArgumentPermissions.checkGroup(plugin, sender, target, context) ||
|
||||
ArgumentPermissions.checkArguments(plugin, sender, permission, node)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
Node builtNode = NodeBuilders.determineMostApplicable(node).expiry(10L).withContext(context).build();
|
||||
@ -85,7 +84,7 @@ public class PermissionUnsetTemp extends GenericChildCommand {
|
||||
if (builtNode instanceof InheritanceNode) {
|
||||
if (ArgumentPermissions.checkGroup(plugin, sender, ((InheritanceNode) builtNode).getGroupName(), context)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,10 +107,8 @@ public class PermissionUnsetTemp extends GenericChildCommand {
|
||||
}
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.DOES_NOT_HAVE_TEMP_PERMISSION.send(sender, target, node, context);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.group;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -53,21 +52,21 @@ public class CreateGroup extends SingleCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
if (args.isEmpty()) {
|
||||
sendUsage(sender, label);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
String groupName = args.get(0).toLowerCase();
|
||||
if (!DataConstraints.GROUP_NAME_TEST.test(groupName)) {
|
||||
Message.GROUP_INVALID_ENTRY.send(sender, groupName);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.getStorage().loadGroup(groupName).join().isPresent()) {
|
||||
Message.ALREADY_EXISTS.send(sender, groupName);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
Integer weight = null;
|
||||
@ -99,7 +98,7 @@ public class CreateGroup extends SingleCommand {
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().warn("Error whilst creating group", e);
|
||||
Message.CREATE_ERROR.send(sender, Component.text(groupName));
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
Message.CREATE_SUCCESS.send(sender, Component.text(groupName));
|
||||
@ -107,7 +106,5 @@ public class CreateGroup extends SingleCommand {
|
||||
LoggedAction.build().source(sender).targetName(groupName).targetType(Action.Target.Type.GROUP)
|
||||
.description("create")
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.group;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -52,28 +51,28 @@ public class DeleteGroup extends SingleCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
if (args.isEmpty()) {
|
||||
sendUsage(sender, label);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
String groupName = args.get(0).toLowerCase();
|
||||
|
||||
if (groupName.equalsIgnoreCase(GroupManager.DEFAULT_GROUP_NAME)) {
|
||||
Message.DELETE_GROUP_ERROR_DEFAULT.send(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
Group group = plugin.getStorage().loadGroup(groupName).join().orElse(null);
|
||||
if (group == null) {
|
||||
Message.GROUP_LOAD_ERROR.send(sender);
|
||||
return CommandResult.LOADING_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, getPermission().get(), group)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -81,7 +80,7 @@ public class DeleteGroup extends SingleCommand {
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().warn("Error whilst deleting group", e);
|
||||
Message.DELETE_ERROR.send(sender, group.getFormattedDisplayName());
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
Message.DELETE_SUCCESS.send(sender, group.getFormattedDisplayName());
|
||||
@ -91,7 +90,6 @@ public class DeleteGroup extends SingleCommand {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
plugin.getSyncTaskBuffer().request();
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.group;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -49,27 +48,27 @@ public class GroupClone extends ChildCommand<Group> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Group target, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Group target, ArgumentList args, String label) {
|
||||
if (ArgumentPermissions.checkViewPerms(plugin, sender, getPermission().get(), target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String newGroupName = args.get(0).toLowerCase();
|
||||
if (!DataConstraints.GROUP_NAME_TEST.test(newGroupName)) {
|
||||
Message.GROUP_INVALID_ENTRY.send(sender, newGroupName);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
Group newGroup = plugin.getStorage().createAndLoadGroup(newGroupName, CreationCause.COMMAND).join();
|
||||
if (newGroup == null) {
|
||||
Message.GROUP_LOAD_ERROR.send(sender);
|
||||
return CommandResult.LOADING_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, getPermission().get(), newGroup)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
newGroup.setNodes(DataType.NORMAL, target.normalData().asList(), false);
|
||||
@ -81,6 +80,5 @@ public class GroupClone extends ChildCommand<Group> {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(newGroup, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.group;
|
||||
|
||||
import me.lucko.luckperms.common.cacheddata.type.MetaCache;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -53,10 +52,10 @@ public class GroupInfo extends ChildCommand<Group> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Group target, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Group target, ArgumentList args, String label) {
|
||||
if (ArgumentPermissions.checkViewPerms(plugin, sender, getPermission().get(), target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
Message.GROUP_INFO_GENERAL.send(sender, target.getName(), target.getPlainDisplayName(), target.getWeight());
|
||||
@ -92,6 +91,5 @@ public class GroupInfo extends ChildCommand<Group> {
|
||||
Map<String, List<String>> meta = data.getMeta(MetaCheckEvent.Origin.INTERNAL);
|
||||
|
||||
Message.GROUP_INFO_CONTEXTUAL_DATA.send(sender, prefix, suffix, meta);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ package me.lucko.luckperms.common.commands.group;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import me.lucko.luckperms.common.cache.LoadingMap;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -64,10 +63,10 @@ public class GroupListMembers extends ChildCommand<Group> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Group target, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Group target, ArgumentList args, String label) {
|
||||
if (ArgumentPermissions.checkViewPerms(plugin, sender, getPermission().get(), target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
InheritanceNode node = Inheritance.builder(target.getName()).build();
|
||||
@ -110,8 +109,6 @@ public class GroupListMembers extends ChildCommand<Group> {
|
||||
if (!matchedGroups.isEmpty()) {
|
||||
sendResult(sender, matchedGroups, Function.identity(), Message.SEARCH_SHOWING_GROUPS, HolderType.GROUP, label, page);
|
||||
}
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
private static <T extends Comparable<T>> void sendResult(Sender sender, List<NodeEntry<T, InheritanceNode>> results, Function<T, String> lookupFunction, Message.Args3<Integer, Integer, Integer> headerMessage, HolderType holderType, String label, int page) {
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.group;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -51,21 +50,21 @@ public class GroupRename extends ChildCommand<Group> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Group target, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Group target, ArgumentList args, String label) {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, getPermission().get(), target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String newGroupName = args.get(0).toLowerCase();
|
||||
if (!DataConstraints.GROUP_NAME_TEST.test(newGroupName)) {
|
||||
Message.GROUP_INVALID_ENTRY.send(sender, newGroupName);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.getStorage().loadGroup(newGroupName).join().isPresent()) {
|
||||
Message.ALREADY_EXISTS.send(sender, newGroupName);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
Group newGroup;
|
||||
@ -74,7 +73,7 @@ public class GroupRename extends ChildCommand<Group> {
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().warn("Error whilst creating group", e);
|
||||
Message.CREATE_ERROR.send(sender, Component.text(newGroupName));
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -82,7 +81,7 @@ public class GroupRename extends ChildCommand<Group> {
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().warn("Error whilst deleting group", e);
|
||||
Message.DELETE_ERROR.send(sender, target.getFormattedDisplayName());
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
newGroup.setNodes(DataType.NORMAL, target.normalData().asList(), false);
|
||||
@ -94,6 +93,5 @@ public class GroupRename extends ChildCommand<Group> {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(newGroup, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.group;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -56,10 +55,10 @@ public class GroupSetDisplayName extends ChildCommand<Group> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Group target, ArgumentList args, String label) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Group target, ArgumentList args, String label) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, getPermission().get(), target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String name = args.get(0);
|
||||
@ -74,18 +73,18 @@ public class GroupSetDisplayName extends ChildCommand<Group> {
|
||||
|
||||
if (previousName == null && name.equals(target.getName())) {
|
||||
Message.GROUP_SET_DISPLAY_NAME_DOESNT_HAVE.send(sender, target.getName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (name.equals(previousName)) {
|
||||
Message.GROUP_SET_DISPLAY_NAME_ALREADY_HAS.send(sender, target.getName(), name);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
Group existing = plugin.getGroupManager().getByDisplayName(name);
|
||||
if (existing != null && !target.equals(existing)) {
|
||||
Message.GROUP_SET_DISPLAY_NAME_ALREADY_IN_USE.send(sender, name, existing.getName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
target.removeIf(DataType.NORMAL, context, NodeType.DISPLAY_NAME::matches, false);
|
||||
@ -98,7 +97,7 @@ public class GroupSetDisplayName extends ChildCommand<Group> {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
target.setNode(DataType.NORMAL, DisplayName.builder(name).withContext(context).build(), true);
|
||||
@ -110,7 +109,6 @@ public class GroupSetDisplayName extends ChildCommand<Group> {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.group;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -50,10 +49,10 @@ public class GroupSetWeight extends ChildCommand<Group> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Group target, ArgumentList args, String label) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Group target, ArgumentList args, String label) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, getPermission().get(), target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
int weight = args.getPriority(0);
|
||||
@ -68,6 +67,5 @@ public class GroupSetWeight extends ChildCommand<Group> {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.group;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -45,13 +44,13 @@ public class ListGroups extends SingleCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
try {
|
||||
plugin.getStorage().loadAllGroups().get();
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().warn("Error whilst loading groups", e);
|
||||
Message.GROUPS_LOAD_ERROR.send(sender);
|
||||
return CommandResult.LOADING_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
Message.GROUPS_LIST.send(sender);
|
||||
@ -64,7 +63,5 @@ public class ListGroups extends SingleCommand {
|
||||
List<String> tracks = plugin.getTrackManager().getAll().values().stream().filter(t -> t.containsGroup(group)).map(Track::getName).collect(Collectors.toList());
|
||||
Message.GROUPS_LIST_ENTRY.send(sender, group, group.getWeight().orElse(0), tracks);
|
||||
});
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ package me.lucko.luckperms.common.commands.log;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.Log;
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -51,28 +50,28 @@ public class LogGroupHistory extends ChildCommand<Log> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Log log, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Log log, ArgumentList args, String label) {
|
||||
String group = args.get(0).toLowerCase();
|
||||
if (!DataConstraints.GROUP_NAME_TEST.test(group)) {
|
||||
Message.GROUP_INVALID_ENTRY.send(sender, group);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
Paginated<LoggedAction> content = new Paginated<>(log.getGroupHistory(group));
|
||||
|
||||
int page = args.getIntOrDefault(1, Integer.MIN_VALUE);
|
||||
if (page != Integer.MIN_VALUE) {
|
||||
return showLog(page, sender, content);
|
||||
showLog(page, sender, content);
|
||||
} else {
|
||||
return showLog(content.getMaxPages(ENTRIES_PER_PAGE), sender, content);
|
||||
showLog(content.getMaxPages(ENTRIES_PER_PAGE), sender, content);
|
||||
}
|
||||
}
|
||||
|
||||
private static CommandResult showLog(int page, Sender sender, Paginated<LoggedAction> log) {
|
||||
private static void showLog(int page, Sender sender, Paginated<LoggedAction> log) {
|
||||
int maxPage = log.getMaxPages(ENTRIES_PER_PAGE);
|
||||
if (maxPage == 0) {
|
||||
Message.LOG_NO_ENTRIES.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (page == Integer.MIN_VALUE) {
|
||||
@ -81,7 +80,7 @@ public class LogGroupHistory extends ChildCommand<Log> {
|
||||
|
||||
if (page < 1 || page > maxPage) {
|
||||
Message.LOG_INVALID_PAGE_RANGE.send(sender, maxPage);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
List<Paginated.Entry<LoggedAction>> entries = log.getPage(page, ENTRIES_PER_PAGE);
|
||||
@ -91,8 +90,6 @@ public class LogGroupHistory extends ChildCommand<Log> {
|
||||
for (Paginated.Entry<LoggedAction> e : entries) {
|
||||
Message.LOG_ENTRY.send(sender, e.position(), e.value());
|
||||
}
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.log;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.Log;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -85,10 +84,10 @@ public class LogNotify extends ChildCommand<Log> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Log log, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Log log, ArgumentList args, String label) {
|
||||
if (sender.isConsole()) {
|
||||
Message.LOG_NOTIFY_CONSOLE.send(sender);
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
final UUID uuid = sender.getUniqueId();
|
||||
@ -97,42 +96,41 @@ public class LogNotify extends ChildCommand<Log> {
|
||||
// toggle on
|
||||
setIgnoring(plugin, uuid, false);
|
||||
Message.LOG_NOTIFY_TOGGLE_ON.send(sender);
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
// toggle off
|
||||
setIgnoring(plugin, uuid, true);
|
||||
Message.LOG_NOTIFY_TOGGLE_OFF.send(sender);
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.get(0).equalsIgnoreCase("on")) {
|
||||
if (!isIgnoring(plugin, uuid)) {
|
||||
// already on
|
||||
Message.LOG_NOTIFY_ALREADY_ON.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
// toggle on
|
||||
setIgnoring(plugin, uuid, false);
|
||||
Message.LOG_NOTIFY_TOGGLE_ON.send(sender);
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.get(0).equalsIgnoreCase("off")) {
|
||||
if (isIgnoring(plugin, uuid)) {
|
||||
// already off
|
||||
Message.LOG_NOTIFY_ALREADY_OFF.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
// toggle off
|
||||
setIgnoring(plugin, uuid, true);
|
||||
Message.LOG_NOTIFY_TOGGLE_OFF.send(sender);
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
// not recognised
|
||||
Message.LOG_NOTIFY_UNKNOWN.send(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ package me.lucko.luckperms.common.commands.log;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.Log;
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -49,44 +48,46 @@ public class LogRecent extends ChildCommand<Log> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Log log, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Log log, ArgumentList args, String label) {
|
||||
if (args.isEmpty()) {
|
||||
// No page or user
|
||||
Paginated<LoggedAction> content = new Paginated<>(log.getContent());
|
||||
return showLog(content.getMaxPages(ENTRIES_PER_PAGE), false, sender, content);
|
||||
showLog(content.getMaxPages(ENTRIES_PER_PAGE), false, sender, content);
|
||||
return;
|
||||
}
|
||||
|
||||
int page = args.getIntOrDefault(0, Integer.MIN_VALUE);
|
||||
if (page != Integer.MIN_VALUE) {
|
||||
Paginated<LoggedAction> content = new Paginated<>(log.getContent());
|
||||
return showLog(page, false, sender, content);
|
||||
showLog(page, false, sender, content);
|
||||
return;
|
||||
}
|
||||
|
||||
// User and possibly page
|
||||
UUID uuid = args.getUserTarget(0, plugin, sender);
|
||||
if (uuid == null) {
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
Paginated<LoggedAction> content = new Paginated<>(log.getContent(uuid));
|
||||
page = args.getIntOrDefault(1, Integer.MIN_VALUE);
|
||||
if (page != Integer.MIN_VALUE) {
|
||||
return showLog(page, true, sender, content);
|
||||
showLog(page, true, sender, content);
|
||||
} else {
|
||||
return showLog(content.getMaxPages(ENTRIES_PER_PAGE), true, sender, content);
|
||||
showLog(content.getMaxPages(ENTRIES_PER_PAGE), true, sender, content);
|
||||
}
|
||||
}
|
||||
|
||||
private static CommandResult showLog(int page, boolean specificUser, Sender sender, Paginated<LoggedAction> log) {
|
||||
private static void showLog(int page, boolean specificUser, Sender sender, Paginated<LoggedAction> log) {
|
||||
int maxPage = log.getMaxPages(ENTRIES_PER_PAGE);
|
||||
if (maxPage == 0) {
|
||||
Message.LOG_NO_ENTRIES.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (page < 1 || page > maxPage) {
|
||||
Message.LOG_INVALID_PAGE_RANGE.send(sender, maxPage);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
List<Paginated.Entry<LoggedAction>> entries = log.getPage(page, ENTRIES_PER_PAGE);
|
||||
@ -103,6 +104,5 @@ public class LogRecent extends ChildCommand<Log> {
|
||||
for (Paginated.Entry<LoggedAction> e : entries) {
|
||||
Message.LOG_ENTRY.send(sender, e.position(), e.value());
|
||||
}
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ package me.lucko.luckperms.common.commands.log;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.Log;
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -48,7 +47,7 @@ public class LogSearch extends ChildCommand<Log> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Log log, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Log log, ArgumentList args, String label) {
|
||||
int page = Integer.MIN_VALUE;
|
||||
if (args.size() > 1) {
|
||||
try {
|
||||
@ -63,17 +62,17 @@ public class LogSearch extends ChildCommand<Log> {
|
||||
Paginated<LoggedAction> content = new Paginated<>(log.getSearch(query));
|
||||
|
||||
if (page != Integer.MIN_VALUE) {
|
||||
return showLog(page, query, sender, content);
|
||||
showLog(page, query, sender, content);
|
||||
} else {
|
||||
return showLog(content.getMaxPages(ENTRIES_PER_PAGE), query, sender, content);
|
||||
showLog(content.getMaxPages(ENTRIES_PER_PAGE), query, sender, content);
|
||||
}
|
||||
}
|
||||
|
||||
private static CommandResult showLog(int page, String query, Sender sender, Paginated<LoggedAction> log) {
|
||||
private static void showLog(int page, String query, Sender sender, Paginated<LoggedAction> log) {
|
||||
int maxPage = log.getMaxPages(ENTRIES_PER_PAGE);
|
||||
if (maxPage == 0) {
|
||||
Message.LOG_NO_ENTRIES.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (page == Integer.MIN_VALUE) {
|
||||
@ -82,7 +81,7 @@ public class LogSearch extends ChildCommand<Log> {
|
||||
|
||||
if (page < 1 || page > maxPage) {
|
||||
Message.LOG_INVALID_PAGE_RANGE.send(sender, maxPage);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
List<Paginated.Entry<LoggedAction>> entries = log.getPage(page, ENTRIES_PER_PAGE);
|
||||
@ -91,7 +90,5 @@ public class LogSearch extends ChildCommand<Log> {
|
||||
for (Paginated.Entry<LoggedAction> e : entries) {
|
||||
Message.LOG_ENTRY.send(sender, e.position(), e.value());
|
||||
}
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ package me.lucko.luckperms.common.commands.log;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.Log;
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -51,28 +50,28 @@ public class LogTrackHistory extends ChildCommand<Log> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Log log, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Log log, ArgumentList args, String label) {
|
||||
String track = args.get(0).toLowerCase();
|
||||
if (!DataConstraints.TRACK_NAME_TEST.test(track)) {
|
||||
Message.TRACK_INVALID_ENTRY.send(sender, track);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
Paginated<LoggedAction> content = new Paginated<>(log.getTrackHistory(track));
|
||||
|
||||
int page = args.getIntOrDefault(1, Integer.MIN_VALUE);
|
||||
if (page != Integer.MIN_VALUE) {
|
||||
return showLog(page, sender, content);
|
||||
showLog(page, sender, content);
|
||||
} else {
|
||||
return showLog(content.getMaxPages(ENTRIES_PER_PAGE), sender, content);
|
||||
showLog(content.getMaxPages(ENTRIES_PER_PAGE), sender, content);
|
||||
}
|
||||
}
|
||||
|
||||
private static CommandResult showLog(int page, Sender sender, Paginated<LoggedAction> log) {
|
||||
private static void showLog(int page, Sender sender, Paginated<LoggedAction> log) {
|
||||
int maxPage = log.getMaxPages(ENTRIES_PER_PAGE);
|
||||
if (maxPage == 0) {
|
||||
Message.LOG_NO_ENTRIES.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (page == Integer.MIN_VALUE) {
|
||||
@ -81,7 +80,7 @@ public class LogTrackHistory extends ChildCommand<Log> {
|
||||
|
||||
if (page < 1 || page > maxPage) {
|
||||
Message.LOG_INVALID_PAGE_RANGE.send(sender, maxPage);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
List<Paginated.Entry<LoggedAction>> entries = log.getPage(page, ENTRIES_PER_PAGE);
|
||||
@ -91,8 +90,6 @@ public class LogTrackHistory extends ChildCommand<Log> {
|
||||
for (Paginated.Entry<LoggedAction> e : entries) {
|
||||
Message.LOG_ENTRY.send(sender, e.position(), e.value());
|
||||
}
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,7 +27,6 @@ package me.lucko.luckperms.common.commands.log;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.Log;
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -49,32 +48,32 @@ public class LogUserHistory extends ChildCommand<Log> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Log log, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Log log, ArgumentList args, String label) {
|
||||
UUID uuid = args.getUserTarget(0, plugin, sender);
|
||||
if (uuid == null) {
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
Paginated<LoggedAction> content = new Paginated<>(log.getUserHistory(uuid));
|
||||
|
||||
int page = args.getIntOrDefault(1, Integer.MIN_VALUE);
|
||||
if (page != Integer.MIN_VALUE) {
|
||||
return showLog(page, sender, content);
|
||||
showLog(page, sender, content);
|
||||
} else {
|
||||
return showLog(content.getMaxPages(ENTRIES_PER_PAGE), sender, content);
|
||||
showLog(content.getMaxPages(ENTRIES_PER_PAGE), sender, content);
|
||||
}
|
||||
}
|
||||
|
||||
private static CommandResult showLog(int page, Sender sender, Paginated<LoggedAction> log) {
|
||||
private static void showLog(int page, Sender sender, Paginated<LoggedAction> log) {
|
||||
int maxPage = log.getMaxPages(ENTRIES_PER_PAGE);
|
||||
if (maxPage == 0) {
|
||||
Message.LOG_NO_ENTRIES.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (page < 1 || page > maxPage) {
|
||||
Message.LOG_INVALID_PAGE_RANGE.send(sender, maxPage);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
List<Paginated.Entry<LoggedAction>> entries = log.getPage(page, ENTRIES_PER_PAGE);
|
||||
@ -84,7 +83,5 @@ public class LogUserHistory extends ChildCommand<Log> {
|
||||
for (Paginated.Entry<LoggedAction> e : entries) {
|
||||
Message.LOG_ENTRY.send(sender, e.position(), e.value());
|
||||
}
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ package me.lucko.luckperms.common.commands.misc;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -47,12 +46,12 @@ public class ApplyEditsCommand extends SingleCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
String code = args.get(0);
|
||||
|
||||
if (code.isEmpty()) {
|
||||
Message.APPLY_EDITS_INVALID_CODE.send(sender, code);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
JsonObject data;
|
||||
@ -60,20 +59,19 @@ public class ApplyEditsCommand extends SingleCommand {
|
||||
data = plugin.getBytebin().getJsonContent(code).getAsJsonObject();
|
||||
} catch (UnsuccessfulRequestException e) {
|
||||
Message.EDITOR_HTTP_REQUEST_FAILURE.send(sender, e.getResponse().code(), e.getResponse().message());
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
} catch (IOException e) {
|
||||
plugin.getLogger().warn("Error reading data from bytebin", e);
|
||||
Message.EDITOR_HTTP_UNKNOWN_FAILURE.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (data == null) {
|
||||
Message.APPLY_EDITS_UNABLE_TO_READ.send(sender, code);
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
new WebEditorResponse(data).apply(plugin, sender);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,7 +38,6 @@ import me.lucko.luckperms.common.bulkupdate.comparison.Constraint;
|
||||
import me.lucko.luckperms.common.bulkupdate.comparison.StandardComparison;
|
||||
import me.lucko.luckperms.common.bulkupdate.query.Query;
|
||||
import me.lucko.luckperms.common.bulkupdate.query.QueryField;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -63,10 +62,10 @@ public class BulkUpdateCommand extends SingleCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) throws CommandException {
|
||||
if (!sender.isConsole()) {
|
||||
Message.BULK_UPDATE_MUST_USE_CONSOLE.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.size() == 2 && args.get(0).equalsIgnoreCase("confirm")) {
|
||||
@ -75,11 +74,11 @@ public class BulkUpdateCommand extends SingleCommand {
|
||||
|
||||
if (operation == null) {
|
||||
Message.BULK_UPDATE_UNKNOWN_ID.send(sender, id);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
runOperation(operation, plugin, sender);
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.size() < 2) {
|
||||
@ -94,7 +93,7 @@ public class BulkUpdateCommand extends SingleCommand {
|
||||
bulkUpdateBuilder.dataType(DataType.valueOf(args.remove(0).toUpperCase()));
|
||||
} catch (IllegalArgumentException e) {
|
||||
Message.BULK_UPDATE_INVALID_DATA_TYPE.send(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
String action = args.remove(0).toLowerCase();
|
||||
@ -124,19 +123,19 @@ public class BulkUpdateCommand extends SingleCommand {
|
||||
String[] parts = constraint.split(" ");
|
||||
if (parts.length != 3) {
|
||||
Message.BULK_UPDATE_INVALID_CONSTRAINT.send(sender, constraint);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
QueryField field = QueryField.of(parts[0]);
|
||||
if (field == null) {
|
||||
Message.BULK_UPDATE_INVALID_CONSTRAINT.send(sender, constraint);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
Comparison comparison = StandardComparison.parseComparison(parts[1]);
|
||||
if (comparison == null) {
|
||||
Message.BULK_UPDATE_INVALID_COMPARISON.send(sender, parts[1]);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
String expr = parts[2];
|
||||
@ -154,8 +153,6 @@ public class BulkUpdateCommand extends SingleCommand {
|
||||
Message.BULK_UPDATE_QUEUED.send(sender, bulkUpdate.buildAsSql().toReadableString().replace("{table}", bulkUpdate.getDataType().getName()));
|
||||
Message.BULK_UPDATE_CONFIRM.send(sender, label, id);
|
||||
}
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
private static void runOperation(BulkUpdate operation, LuckPermsPlugin plugin, Sender sender) {
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.misc;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -53,7 +52,7 @@ public class EditorCommand extends SingleCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
Type type = Type.ALL;
|
||||
String filter = null;
|
||||
|
||||
@ -92,7 +91,7 @@ public class EditorCommand extends SingleCommand {
|
||||
|
||||
if (holders.isEmpty()) {
|
||||
Message.EDITOR_NO_MATCH.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
// remove holders which the sender doesn't have perms to view
|
||||
@ -102,12 +101,12 @@ public class EditorCommand extends SingleCommand {
|
||||
// they don't have perms to view any of them
|
||||
if (holders.isEmpty() && tracks.isEmpty()) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
Message.EDITOR_START.send(sender);
|
||||
|
||||
return WebEditorRequest.generate(holders, tracks, sender, label, plugin)
|
||||
WebEditorRequest.generate(holders, tracks, sender, label, plugin)
|
||||
.createSession(plugin, sender);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.misc;
|
||||
|
||||
import me.lucko.luckperms.common.backup.Exporter;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -49,10 +48,10 @@ public class ExportCommand extends SingleCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
if (this.running.get()) {
|
||||
Message.EXPORT_ALREADY_RUNNING.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
boolean includeUsers = !args.remove("--without-users");
|
||||
@ -63,7 +62,7 @@ public class ExportCommand extends SingleCommand {
|
||||
if (upload) {
|
||||
if (!this.running.compareAndSet(false, true)) {
|
||||
Message.EXPORT_ALREADY_RUNNING.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
exporter = new Exporter.WebUpload(plugin, sender, includeUsers, includeGroups, label);
|
||||
@ -73,12 +72,12 @@ public class ExportCommand extends SingleCommand {
|
||||
|
||||
if (!path.getParent().equals(dataDirectory)) {
|
||||
Message.FILE_NOT_WITHIN_DIRECTORY.send(sender, path.toString());
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Files.exists(path)) {
|
||||
Message.EXPORT_FILE_ALREADY_EXISTS.send(sender, path.toString());
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -86,17 +85,17 @@ public class ExportCommand extends SingleCommand {
|
||||
} catch (IOException e) {
|
||||
Message.EXPORT_FILE_FAILURE.send(sender);
|
||||
plugin.getLogger().warn("Error whilst writing to the file", e);
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Files.isWritable(path)) {
|
||||
Message.EXPORT_FILE_NOT_WRITABLE.send(sender, path.toString());
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.running.compareAndSet(false, true)) {
|
||||
Message.EXPORT_ALREADY_RUNNING.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
exporter = new Exporter.SaveFile(plugin, sender, path, includeUsers, includeGroups);
|
||||
@ -110,8 +109,6 @@ public class ExportCommand extends SingleCommand {
|
||||
this.running.set(false);
|
||||
}
|
||||
});
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ package me.lucko.luckperms.common.commands.misc;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import me.lucko.luckperms.common.backup.Importer;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -57,10 +56,10 @@ public class ImportCommand extends SingleCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
if (this.running.get()) {
|
||||
Message.IMPORT_ALREADY_RUNNING.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
boolean fromFile = !args.remove("--upload");
|
||||
@ -73,7 +72,7 @@ public class ImportCommand extends SingleCommand {
|
||||
|
||||
if (!path.getParent().equals(dataDirectory) || path.getFileName().toString().equals("config.yml")) {
|
||||
Message.FILE_NOT_WITHIN_DIRECTORY.send(sender, path.toString());
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
// try auto adding the '.json.gz' extension
|
||||
@ -86,17 +85,17 @@ public class ImportCommand extends SingleCommand {
|
||||
|
||||
if (!Files.exists(path)) {
|
||||
Message.IMPORT_FILE_DOESNT_EXIST.send(sender, path.toString());
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Files.isReadable(path)) {
|
||||
Message.IMPORT_FILE_NOT_READABLE.send(sender, path.toString());
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.running.compareAndSet(false, true)) {
|
||||
Message.IMPORT_ALREADY_RUNNING.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(new GZIPInputStream(Files.newInputStream(path)), StandardCharsets.UTF_8))) {
|
||||
@ -105,30 +104,30 @@ public class ImportCommand extends SingleCommand {
|
||||
plugin.getLogger().warn("Error whilst reading from the import file", e);
|
||||
Message.IMPORT_FILE_READ_FAILURE.send(sender);
|
||||
this.running.set(false);
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
String code = args.get(0);
|
||||
|
||||
if (code.isEmpty()) {
|
||||
Message.IMPORT_WEB_INVALID_CODE.send(sender, code);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
data = plugin.getBytebin().getJsonContent(code).getAsJsonObject();
|
||||
} catch (UnsuccessfulRequestException e) {
|
||||
Message.HTTP_REQUEST_FAILURE.send(sender, e.getResponse().code(), e.getResponse().message());
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
} catch (IOException e) {
|
||||
plugin.getLogger().severe("Error reading data to bytebin", e);
|
||||
Message.HTTP_UNKNOWN_FAILURE.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (data == null) {
|
||||
Message.IMPORT_UNABLE_TO_READ.send(sender, code);
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,8 +141,6 @@ public class ImportCommand extends SingleCommand {
|
||||
this.running.set(false);
|
||||
}
|
||||
});
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.misc;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -45,10 +44,9 @@ public class InfoCommand extends SingleCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
Map<Component, Component> storageMeta = plugin.getStorage().getMeta();
|
||||
Message.INFO.send(sender, plugin, storageMeta);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.misc;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -44,7 +43,7 @@ public class NetworkSyncCommand extends SingleCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
Message.UPDATE_TASK_REQUEST.send(sender);
|
||||
plugin.getSyncTaskBuffer().request().join();
|
||||
Message.UPDATE_TASK_COMPLETE_NETWORK.send(sender);
|
||||
@ -52,17 +51,15 @@ public class NetworkSyncCommand extends SingleCommand {
|
||||
Optional<InternalMessagingService> messagingService = plugin.getMessagingService();
|
||||
if (!messagingService.isPresent()) {
|
||||
Message.UPDATE_TASK_PUSH_FAILURE_NOT_SETUP.send(sender);
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
messagingService.get().pushUpdate();
|
||||
Message.UPDATE_TASK_PUSH_SUCCESS.send(sender, messagingService.get().getName());
|
||||
return CommandResult.SUCCESS;
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().warn("Error whilst pushing changes to other servers", e);
|
||||
Message.UPDATE_TASK_PUSH_FAILURE.send(sender);
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.misc;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -41,9 +40,8 @@ public class ReloadConfigCommand extends SingleCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
plugin.getConfiguration().reload();
|
||||
Message.RELOAD_CONFIG_SUCCESS.send(sender);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ import me.lucko.luckperms.common.bulkupdate.comparison.Comparison;
|
||||
import me.lucko.luckperms.common.bulkupdate.comparison.Constraint;
|
||||
import me.lucko.luckperms.common.bulkupdate.comparison.StandardComparison;
|
||||
import me.lucko.luckperms.common.cache.LoadingMap;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -64,7 +63,7 @@ public class SearchCommand extends SingleCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
Comparison comparison = StandardComparison.parseComparison(args.get(0));
|
||||
if (comparison == null) {
|
||||
comparison = StandardComparison.EQUAL;
|
||||
@ -92,8 +91,6 @@ public class SearchCommand extends SingleCommand {
|
||||
if (!matchedGroups.isEmpty()) {
|
||||
sendResult(sender, matchedGroups, Function.identity(), Message.SEARCH_SHOWING_GROUPS, HolderType.GROUP, label, page, comparison);
|
||||
}
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.misc;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -41,10 +40,9 @@ public class SyncCommand extends SingleCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
Message.UPDATE_TASK_REQUEST.send(sender);
|
||||
plugin.getSyncTaskBuffer().request().join();
|
||||
Message.UPDATE_TASK_COMPLETE.send(sender);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.misc;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -52,7 +51,7 @@ public class TranslationsCommand extends SingleCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
Message.TRANSLATIONS_SEARCHING.send(sender);
|
||||
|
||||
List<LanguageInfo> availableTranslations;
|
||||
@ -61,14 +60,14 @@ public class TranslationsCommand extends SingleCommand {
|
||||
} catch (IOException | UnsuccessfulRequestException e) {
|
||||
Message.TRANSLATIONS_SEARCHING_ERROR.send(sender);
|
||||
plugin.getLogger().warn("Unable to obtain a list of available translations", e);
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.size() >= 1 && args.get(0).equalsIgnoreCase("install")) {
|
||||
Message.TRANSLATIONS_INSTALLING.send(sender);
|
||||
plugin.getTranslationRepository().downloadAndInstallTranslations(availableTranslations, sender, true);
|
||||
Message.TRANSLATIONS_INSTALL_COMPLETE.send(sender);
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
Message.INSTALLED_TRANSLATIONS.send(sender, plugin.getTranslationManager().getInstalledLocales().stream().map(Locale::toString).collect(Collectors.toList()));
|
||||
@ -79,7 +78,6 @@ public class TranslationsCommand extends SingleCommand {
|
||||
}
|
||||
sender.sendMessage(Message.prefixed(Component.empty()));
|
||||
Message.TRANSLATIONS_DOWNLOAD_PROMPT.send(sender, label);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.misc;
|
||||
|
||||
import me.lucko.luckperms.common.cacheddata.type.PermissionCache;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -50,7 +49,7 @@ public class TreeCommand extends SingleCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
String selection = ".";
|
||||
String player = null;
|
||||
|
||||
@ -72,7 +71,7 @@ public class TreeCommand extends SingleCommand {
|
||||
|
||||
if (user == null) {
|
||||
Message.USER_NOT_ONLINE.send(sender, player);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
user = null;
|
||||
@ -81,7 +80,7 @@ public class TreeCommand extends SingleCommand {
|
||||
TreeView view = new TreeView(plugin.getPermissionRegistry(), selection);
|
||||
if (!view.hasData()) {
|
||||
Message.TREE_EMPTY.send(sender);
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
Message.TREE_UPLOAD_START.send(sender);
|
||||
@ -92,15 +91,14 @@ public class TreeCommand extends SingleCommand {
|
||||
id = view.uploadPasteData(plugin.getBytebin(), sender, user, permissionData);
|
||||
} catch (UnsuccessfulRequestException e) {
|
||||
Message.GENERIC_HTTP_REQUEST_FAILURE.send(sender, e.getResponse().code(), e.getResponse().message());
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
} catch (IOException e) {
|
||||
plugin.getLogger().warn("Error uploading data to bytebin", e);
|
||||
Message.GENERIC_HTTP_UNKNOWN_FAILURE.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
String url = plugin.getConfiguration().get(ConfigKeys.TREE_VIEWER_URL_PATTERN) + id;
|
||||
Message.TREE_URL.send(sender, url);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.misc;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -53,10 +52,10 @@ public class VerboseCommand extends SingleCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
if (args.isEmpty()) {
|
||||
sendUsage(sender, label);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
VerboseHandler verboseHandler = plugin.getVerboseHandler();
|
||||
@ -65,7 +64,7 @@ public class VerboseCommand extends SingleCommand {
|
||||
if (mode.equals("command") || mode.equals("cmd")) {
|
||||
if (args.size() < 3) {
|
||||
sendDetailedUsage(sender, label);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
String name = args.get(1);
|
||||
@ -76,7 +75,7 @@ public class VerboseCommand extends SingleCommand {
|
||||
} else {
|
||||
if (!CommandPermission.VERBOSE_COMMAND_OTHERS.isAuthorized(sender)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
executor = plugin.getOnlineSenders()
|
||||
@ -87,7 +86,7 @@ public class VerboseCommand extends SingleCommand {
|
||||
|
||||
if (executor == null) {
|
||||
Message.USER_NOT_ONLINE.send(sender, name);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,7 +107,7 @@ public class VerboseCommand extends SingleCommand {
|
||||
}
|
||||
});
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode.equals("on") || mode.equals("true") || mode.equals("record")) {
|
||||
@ -124,7 +123,7 @@ public class VerboseCommand extends SingleCommand {
|
||||
compiledFilter = VerboseFilter.compile(filter);
|
||||
} catch (InvalidFilterException e) {
|
||||
Message.VERBOSE_INVALID_FILTER.send(sender, filter, e.getCause().getMessage());
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
boolean notify = !mode.equals("record");
|
||||
@ -145,7 +144,7 @@ public class VerboseCommand extends SingleCommand {
|
||||
}
|
||||
}
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode.equals("off") || mode.equals("false") || mode.equals("paste") || mode.equals("upload")) {
|
||||
@ -162,26 +161,25 @@ public class VerboseCommand extends SingleCommand {
|
||||
id = listener.uploadPasteData(plugin.getBytebin());
|
||||
} catch (UnsuccessfulRequestException e) {
|
||||
Message.GENERIC_HTTP_REQUEST_FAILURE.send(sender, e.getResponse().code(), e.getResponse().message());
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
} catch (IOException e) {
|
||||
plugin.getLogger().warn("Error uploading data to bytebin", e);
|
||||
Message.GENERIC_HTTP_UNKNOWN_FAILURE.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
String url = plugin.getConfiguration().get(ConfigKeys.VERBOSE_VIEWER_URL_PATTERN) + id;
|
||||
Message.VERBOSE_RESULTS_URL.send(sender, url);
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
Message.VERBOSE_OFF.send(sender);
|
||||
}
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
sendUsage(sender, label);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.track;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -47,21 +46,21 @@ public class CreateTrack extends SingleCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
if (args.isEmpty()) {
|
||||
sendUsage(sender, label);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
String trackName = args.get(0).toLowerCase();
|
||||
if (!DataConstraints.TRACK_NAME_TEST.test(trackName)) {
|
||||
Message.TRACK_INVALID_ENTRY.send(sender, trackName);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.getStorage().loadTrack(trackName).join().isPresent()) {
|
||||
Message.ALREADY_EXISTS.send(sender, trackName);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -69,7 +68,7 @@ public class CreateTrack extends SingleCommand {
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().warn("Error whilst creating track", e);
|
||||
Message.CREATE_ERROR.send(sender, Component.text(trackName));
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
Message.CREATE_SUCCESS.send(sender, Component.text(trackName));
|
||||
@ -77,7 +76,5 @@ public class CreateTrack extends SingleCommand {
|
||||
LoggedAction.build().source(sender).targetName(trackName).targetType(Action.Target.Type.TRACK)
|
||||
.description("create").build()
|
||||
.submit(plugin, sender);
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.track;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -52,22 +51,22 @@ public class DeleteTrack extends SingleCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
if (args.isEmpty()) {
|
||||
sendUsage(sender, label);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
String trackName = args.get(0).toLowerCase();
|
||||
Track track = plugin.getStorage().loadTrack(trackName).join().orElse(null);
|
||||
if (track == null) {
|
||||
Message.TRACK_LOAD_ERROR.send(sender);
|
||||
return CommandResult.LOADING_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, getPermission().get(), track)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -75,7 +74,7 @@ public class DeleteTrack extends SingleCommand {
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().warn("Error whilst deleting track", e);
|
||||
Message.DELETE_ERROR.send(sender, Component.text(track.getName()));
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
Message.DELETE_SUCCESS.send(sender, Component.text(trackName));
|
||||
@ -83,8 +82,6 @@ public class DeleteTrack extends SingleCommand {
|
||||
LoggedAction.build().source(sender).targetName(trackName).targetType(Action.Target.Type.TRACK)
|
||||
.description("delete")
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.track;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -43,16 +42,15 @@ public class ListTracks extends SingleCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, ArgumentList args, String label) {
|
||||
try {
|
||||
plugin.getStorage().loadAllTracks().get();
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().warn("Error whilst loading tracks", e);
|
||||
Message.TRACKS_LOAD_ERROR.send(sender);
|
||||
return CommandResult.LOADING_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
Message.TRACKS_LIST.send(sender, plugin.getTrackManager().getAll().keySet().stream().sorted().collect(Collectors.toList()));
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.track;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -53,21 +52,21 @@ public class TrackAppend extends ChildCommand<Track> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Track target, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Track target, ArgumentList args, String label) {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, getPermission().get(), target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String groupName = args.get(0).toLowerCase();
|
||||
if (!DataConstraints.GROUP_NAME_TEST.test(groupName)) {
|
||||
sendDetailedUsage(sender, label);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
Group group = StorageAssistant.loadGroup(groupName, sender, plugin, false);
|
||||
if (group == null) {
|
||||
return CommandResult.LOADING_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
DataMutateResult result = target.appendGroup(group);
|
||||
@ -83,10 +82,8 @@ public class TrackAppend extends ChildCommand<Track> {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.TRACK_ALREADY_CONTAINS.send(sender, target.getName(), group);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.track;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -45,10 +44,10 @@ public class TrackClear extends ChildCommand<Track> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Track target, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Track target, ArgumentList args, String label) {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, getPermission().get(), target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
target.clearGroups();
|
||||
@ -59,6 +58,5 @@ public class TrackClear extends ChildCommand<Track> {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.track;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -49,27 +48,27 @@ public class TrackClone extends ChildCommand<Track> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Track target, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Track target, ArgumentList args, String label) {
|
||||
if (ArgumentPermissions.checkViewPerms(plugin, sender, getPermission().get(), target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String newTrackName = args.get(0).toLowerCase();
|
||||
if (!DataConstraints.TRACK_NAME_TEST.test(newTrackName)) {
|
||||
Message.TRACK_INVALID_ENTRY.send(sender, newTrackName);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
Track newTrack = plugin.getStorage().createAndLoadTrack(newTrackName, CreationCause.INTERNAL).join();
|
||||
if (newTrack == null) {
|
||||
Message.TRACK_LOAD_ERROR.send(sender);
|
||||
return CommandResult.LOADING_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, getPermission().get(), newTrack)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
newTrack.setGroups(target.getGroups());
|
||||
@ -81,6 +80,5 @@ public class TrackClone extends ChildCommand<Track> {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(newTrack, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.track;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -57,10 +56,10 @@ public class TrackEditor extends ChildCommand<Track> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Track target, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Track target, ArgumentList args, String label) {
|
||||
if (ArgumentPermissions.checkViewPerms(plugin, sender, getPermission().get(), target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
// run a sync task
|
||||
@ -75,7 +74,7 @@ public class TrackEditor extends ChildCommand<Track> {
|
||||
|
||||
if (groups.isEmpty()) {
|
||||
Message.EDITOR_NO_MATCH.send(sender);
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
// then collect users which are a member of any of those groups
|
||||
@ -98,7 +97,7 @@ public class TrackEditor extends ChildCommand<Track> {
|
||||
|
||||
Message.EDITOR_START.send(sender);
|
||||
|
||||
return WebEditorRequest.generate(holders, Collections.singletonList(target), sender, label, plugin)
|
||||
WebEditorRequest.generate(holders, Collections.singletonList(target), sender, label, plugin)
|
||||
.createSession(plugin, sender);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.common.commands.track;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -43,13 +42,12 @@ public class TrackInfo extends ChildCommand<Track> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Track target, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Track target, ArgumentList args, String label) {
|
||||
if (ArgumentPermissions.checkViewPerms(plugin, sender, getPermission().get(), target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
Message.TRACK_INFO.send(sender, target.getName(), Message.formatTrackPath(target.getGroups()));
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.track;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -53,16 +52,16 @@ public class TrackInsert extends ChildCommand<Track> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Track target, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Track target, ArgumentList args, String label) {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, getPermission().get(), target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String groupName = args.get(0).toLowerCase();
|
||||
if (!DataConstraints.GROUP_NAME_TEST.test(groupName)) {
|
||||
sendDetailedUsage(sender, label);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
int pos;
|
||||
@ -70,12 +69,12 @@ public class TrackInsert extends ChildCommand<Track> {
|
||||
pos = Integer.parseInt(args.get(1));
|
||||
} catch (NumberFormatException e) {
|
||||
Message.TRACK_INSERT_ERROR_NUMBER.send(sender, args.get(1));
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
Group group = StorageAssistant.loadGroup(groupName, sender, plugin, false);
|
||||
if (group == null) {
|
||||
return CommandResult.LOADING_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -92,15 +91,12 @@ public class TrackInsert extends ChildCommand<Track> {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.TRACK_ALREADY_CONTAINS.send(sender, target.getName(), group);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
Message.TRACK_INSERT_ERROR_INVALID_POS.send(sender, pos);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.track;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -52,16 +51,16 @@ public class TrackRemove extends ChildCommand<Track> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Track target, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Track target, ArgumentList args, String label) {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, getPermission().get(), target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String groupName = args.get(0).toLowerCase();
|
||||
if (!DataConstraints.GROUP_NAME_TEST.test(groupName)) {
|
||||
sendDetailedUsage(sender, label);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
DataMutateResult result = target.removeGroup(groupName);
|
||||
@ -77,10 +76,8 @@ public class TrackRemove extends ChildCommand<Track> {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
} else {
|
||||
Message.TRACK_DOES_NOT_CONTAIN.send(sender, target.getName(), groupName);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.track;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -50,21 +49,21 @@ public class TrackRename extends ChildCommand<Track> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Track target, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Track target, ArgumentList args, String label) {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, getPermission().get(), target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
String newTrackName = args.get(0).toLowerCase();
|
||||
if (!DataConstraints.TRACK_NAME_TEST.test(newTrackName)) {
|
||||
Message.TRACK_INVALID_ENTRY.send(sender, newTrackName);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.getStorage().loadTrack(newTrackName).join().isPresent()) {
|
||||
Message.ALREADY_EXISTS.send(sender, newTrackName);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
Track newTrack;
|
||||
@ -73,7 +72,7 @@ public class TrackRename extends ChildCommand<Track> {
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().warn("Error whilst creating track", e);
|
||||
Message.CREATE_ERROR.send(sender, Component.text(newTrackName));
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -81,7 +80,7 @@ public class TrackRename extends ChildCommand<Track> {
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().warn("Error whilst deleting track", e);
|
||||
Message.DELETE_ERROR.send(sender, Component.text(target.getName()));
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
newTrack.setGroups(target.getGroups());
|
||||
@ -93,6 +92,5 @@ public class TrackRename extends ChildCommand<Track> {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(newTrack, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.user;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -49,26 +48,26 @@ public class UserClone extends ChildCommand<User> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, User target, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, User target, ArgumentList args, String label) {
|
||||
if (ArgumentPermissions.checkViewPerms(plugin, sender, getPermission().get(), target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
UUID uuid = args.getUserTarget(0, plugin, sender);
|
||||
if (uuid == null) {
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
User otherUser = plugin.getStorage().loadUser(uuid, null).join();
|
||||
if (otherUser == null) {
|
||||
Message.USER_LOAD_ERROR.send(sender);
|
||||
return CommandResult.LOADING_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, getPermission().get(), otherUser)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
otherUser.setNodes(DataType.NORMAL, target.normalData().asList(), false);
|
||||
@ -81,6 +80,5 @@ public class UserClone extends ChildCommand<User> {
|
||||
|
||||
StorageAssistant.save(otherUser, sender, plugin);
|
||||
plugin.getUserManager().getHouseKeeper().cleanup(otherUser.getUniqueId());
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.user;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -57,10 +56,10 @@ public class UserDemote extends ChildCommand<User> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, User target, ArgumentList args, String label) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, User target, ArgumentList args, String label) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, getPermission().get(), target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
boolean removeFromFirst = !args.remove("--dont-remove-from-first");
|
||||
@ -74,24 +73,24 @@ public class UserDemote extends ChildCommand<User> {
|
||||
args.add("default");
|
||||
} else {
|
||||
Message.USER_TRACK_ERROR_AMBIGUOUS_TRACK_SELECTION.send(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final String trackName = args.get(0).toLowerCase();
|
||||
if (!DataConstraints.TRACK_NAME_TEST.test(trackName)) {
|
||||
Message.TRACK_INVALID_ENTRY.send(sender, trackName);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
Track track = StorageAssistant.loadTrack(trackName, sender, plugin);
|
||||
if (track == null) {
|
||||
return CommandResult.LOADING_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (track.getSize() <= 1) {
|
||||
Message.TRACK_EMPTY.send(sender, track.getName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
boolean dontShowTrackProgress = args.remove("-s");
|
||||
@ -99,7 +98,7 @@ public class UserDemote extends ChildCommand<User> {
|
||||
|
||||
if (ArgumentPermissions.checkContext(plugin, sender, getPermission().get(), context)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
Predicate<String> previousGroupPermissionChecker = s ->
|
||||
@ -110,21 +109,21 @@ public class UserDemote extends ChildCommand<User> {
|
||||
switch (result.getStatus()) {
|
||||
case NOT_ON_TRACK:
|
||||
Message.USER_TRACK_ERROR_NOT_CONTAIN_GROUP.send(sender, target, track.getName());
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
case AMBIGUOUS_CALL:
|
||||
Message.TRACK_AMBIGUOUS_CALL.send(sender, target);
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
case UNDEFINED_FAILURE:
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
case MALFORMED_TRACK:
|
||||
Message.USER_DEMOTE_ERROR_MALFORMED.send(sender, result.getGroupTo().get());
|
||||
return CommandResult.LOADING_ERROR;
|
||||
return;
|
||||
|
||||
case REMOVED_FROM_FIRST_GROUP: {
|
||||
if (!removeFromFirst && !result.getGroupFrom().isPresent()) {
|
||||
Message.USER_DEMOTE_ENDOFTRACK_NOT_REMOVED.send(sender, track.getName(), target);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
Message.USER_DEMOTE_ENDOFTRACK.send(sender, track.getName(), target, result.getGroupFrom().get());
|
||||
@ -134,7 +133,7 @@ public class UserDemote extends ChildCommand<User> {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
case SUCCESS: {
|
||||
@ -151,7 +150,7 @@ public class UserDemote extends ChildCommand<User> {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.user;
|
||||
|
||||
import me.lucko.luckperms.common.cacheddata.type.MetaCache;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -55,10 +54,10 @@ public class UserInfo extends ChildCommand<User> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, User target, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, User target, ArgumentList args, String label) {
|
||||
if (ArgumentPermissions.checkViewPerms(plugin, sender, getPermission().get(), target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
Message.USER_INFO_GENERAL.send(sender,
|
||||
@ -108,6 +107,5 @@ public class UserInfo extends ChildCommand<User> {
|
||||
Map<String, List<String>> meta = data.getMeta(MetaCheckEvent.Origin.INTERNAL);
|
||||
|
||||
Message.USER_INFO_CONTEXTUAL_DATA.send(sender, active, contextSet, prefix, suffix, primaryGroup, meta);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
package me.lucko.luckperms.common.commands.user;
|
||||
|
||||
import me.lucko.luckperms.common.actionlog.LoggedAction;
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.access.ArgumentPermissions;
|
||||
@ -57,10 +56,10 @@ public class UserPromote extends ChildCommand<User> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, User target, ArgumentList args, String label) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, User target, ArgumentList args, String label) throws CommandException {
|
||||
if (ArgumentPermissions.checkModifyPerms(plugin, sender, getPermission().get(), target)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
boolean addToFirst = !args.remove("--dont-add-to-first");
|
||||
@ -74,24 +73,24 @@ public class UserPromote extends ChildCommand<User> {
|
||||
args.add("default");
|
||||
} else {
|
||||
Message.USER_TRACK_ERROR_AMBIGUOUS_TRACK_SELECTION.send(sender);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final String trackName = args.get(0).toLowerCase();
|
||||
if (!DataConstraints.TRACK_NAME_TEST.test(trackName)) {
|
||||
Message.TRACK_INVALID_ENTRY.send(sender, trackName);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
Track track = StorageAssistant.loadTrack(trackName, sender, plugin);
|
||||
if (track == null) {
|
||||
return CommandResult.LOADING_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (track.getSize() <= 1) {
|
||||
Message.TRACK_EMPTY.send(sender, track.getName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
boolean dontShowTrackProgress = args.remove("-s");
|
||||
@ -99,7 +98,7 @@ public class UserPromote extends ChildCommand<User> {
|
||||
|
||||
if (ArgumentPermissions.checkContext(plugin, sender, getPermission().get(), context)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
Predicate<String> nextGroupPermissionChecker = s ->
|
||||
@ -110,21 +109,21 @@ public class UserPromote extends ChildCommand<User> {
|
||||
switch (result.getStatus()) {
|
||||
case MALFORMED_TRACK:
|
||||
Message.USER_PROMOTE_ERROR_MALFORMED.send(sender, result.getGroupTo().get());
|
||||
return CommandResult.LOADING_ERROR;
|
||||
return;
|
||||
case UNDEFINED_FAILURE:
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
case AMBIGUOUS_CALL:
|
||||
Message.TRACK_AMBIGUOUS_CALL.send(sender, target);
|
||||
return CommandResult.FAILURE;
|
||||
return;
|
||||
case END_OF_TRACK:
|
||||
Message.USER_PROMOTE_ERROR_ENDOFTRACK.send(sender, track.getName(), target);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
|
||||
case ADDED_TO_FIRST_GROUP: {
|
||||
if (!addToFirst && !result.getGroupTo().isPresent()) {
|
||||
Message.USER_PROMOTE_NOT_ON_TRACK.send(sender, target, track.getName());
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
Message.USER_TRACK_ADDED_TO_FIRST.send(sender, target, track.getName(), result.getGroupTo().get(), context);
|
||||
@ -134,7 +133,7 @@ public class UserPromote extends ChildCommand<User> {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
case SUCCESS: {
|
||||
@ -151,7 +150,7 @@ public class UserPromote extends ChildCommand<User> {
|
||||
.build().submit(plugin, sender);
|
||||
|
||||
StorageAssistant.save(target, sender, plugin);
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
|
@ -28,7 +28,6 @@ package me.lucko.luckperms.common.webeditor;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.context.ContextSetJsonSerializer;
|
||||
import me.lucko.luckperms.common.context.contextset.ImmutableContextSetImpl;
|
||||
@ -169,23 +168,22 @@ public class WebEditorRequest {
|
||||
* @param sender the sender creating the session
|
||||
* @return the command result
|
||||
*/
|
||||
public CommandResult createSession(LuckPermsPlugin plugin, Sender sender) {
|
||||
public void createSession(LuckPermsPlugin plugin, Sender sender) {
|
||||
String pasteId;
|
||||
try {
|
||||
pasteId = plugin.getBytebin().postContent(encode(), AbstractHttpClient.JSON_TYPE).key();
|
||||
} catch (UnsuccessfulRequestException e) {
|
||||
Message.EDITOR_HTTP_REQUEST_FAILURE.send(sender, e.getResponse().code(), e.getResponse().message());
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
} catch (IOException e) {
|
||||
new RuntimeException("Error uploading data to bytebin", e).printStackTrace();
|
||||
Message.EDITOR_HTTP_UNKNOWN_FAILURE.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
// form a url for the editor
|
||||
String url = plugin.getConfiguration().get(ConfigKeys.WEB_EDITOR_URL_PATTERN) + pasteId;
|
||||
Message.EDITOR_URL.send(sender, url);
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
public static void includeMatchingGroups(List<? super Group> holders, Predicate<? super Group> filter, LuckPermsPlugin plugin) {
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.sponge.commands;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -43,7 +42,7 @@ public class OptionClear extends ChildCommand<LPSubjectData> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) {
|
||||
ImmutableContextSet contextSet = args.getContextOrEmpty(0);
|
||||
if (contextSet.isEmpty()) {
|
||||
subjectData.clearOptions();
|
||||
@ -52,6 +51,5 @@ public class OptionClear extends ChildCommand<LPSubjectData> {
|
||||
subjectData.clearOptions(contextSet);
|
||||
SpongeCommandUtils.sendPrefixed(sender, "&aCleared options matching contexts &b" + SpongeCommandUtils.contextToString(contextSet));
|
||||
}
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ package me.lucko.luckperms.sponge.commands;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -47,14 +46,14 @@ public class OptionInfo extends ChildCommand<LPSubjectData> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) {
|
||||
ImmutableContextSet contextSet = args.getContextOrEmpty(0);
|
||||
if (contextSet.isEmpty()) {
|
||||
SpongeCommandUtils.sendPrefixed(sender, "&aShowing options matching contexts &bANY&a.");
|
||||
Map<ImmutableContextSet, ImmutableMap<String, String>> options = subjectData.getAllOptions();
|
||||
if (options.isEmpty()) {
|
||||
SpongeCommandUtils.sendPrefixed(sender, "That subject does not have any options defined.");
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
for (Map.Entry<ImmutableContextSet, ImmutableMap<String, String>> e : options.entrySet()) {
|
||||
@ -65,13 +64,12 @@ public class OptionInfo extends ChildCommand<LPSubjectData> {
|
||||
Map<String, String> options = subjectData.getOptions(contextSet);
|
||||
if (options.isEmpty()) {
|
||||
SpongeCommandUtils.sendPrefixed(sender, "That subject does not have any options defined in those contexts.");
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
SpongeCommandUtils.sendPrefixed(sender, "&aShowing options matching contexts &b" +
|
||||
SpongeCommandUtils.contextToString(contextSet) + "&a.\n" + SpongeCommandUtils.optionsToString(options));
|
||||
|
||||
}
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.sponge.commands;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -43,7 +42,7 @@ public class OptionSet extends ChildCommand<LPSubjectData> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) {
|
||||
String key = args.get(0);
|
||||
String value = args.get(1);
|
||||
ImmutableContextSet contextSet = args.getContextOrEmpty(2);
|
||||
@ -53,7 +52,5 @@ public class OptionSet extends ChildCommand<LPSubjectData> {
|
||||
} else {
|
||||
SpongeCommandUtils.sendPrefixed(sender, "Unable to set option. Does the Subject already have it set?");
|
||||
}
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.sponge.commands;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -43,7 +42,7 @@ public class OptionUnset extends ChildCommand<LPSubjectData> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) {
|
||||
String key = args.get(0);
|
||||
ImmutableContextSet contextSet = args.getContextOrEmpty(1);
|
||||
|
||||
@ -52,6 +51,5 @@ public class OptionUnset extends ChildCommand<LPSubjectData> {
|
||||
} else {
|
||||
SpongeCommandUtils.sendPrefixed(sender, "Unable to unset option. Are you sure the Subject has it set?");
|
||||
}
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.sponge.commands;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -48,7 +47,7 @@ public class ParentAdd extends ChildCommand<LPSubjectData> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) {
|
||||
String collection = args.get(0);
|
||||
String name = args.get(1);
|
||||
ImmutableContextSet contextSet = args.getContextOrEmpty(2);
|
||||
@ -71,6 +70,5 @@ public class ParentAdd extends ChildCommand<LPSubjectData> {
|
||||
} else {
|
||||
SpongeCommandUtils.sendPrefixed(sender, "Unable to add parent. Does the Subject already have it added?");
|
||||
}
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.sponge.commands;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -43,7 +42,7 @@ public class ParentClear extends ChildCommand<LPSubjectData> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) {
|
||||
ImmutableContextSet contextSet = args.getContextOrEmpty(0);
|
||||
if (contextSet.isEmpty()) {
|
||||
subjectData.clearParents();
|
||||
@ -52,6 +51,5 @@ public class ParentClear extends ChildCommand<LPSubjectData> {
|
||||
subjectData.clearParents(contextSet);
|
||||
SpongeCommandUtils.sendPrefixed(sender, "&aCleared parents matching contexts &b" + SpongeCommandUtils.contextToString(contextSet));
|
||||
}
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ package me.lucko.luckperms.sponge.commands;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -49,14 +48,14 @@ public class ParentInfo extends ChildCommand<LPSubjectData> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) {
|
||||
ImmutableContextSet contextSet = args.getContextOrEmpty(0);
|
||||
if (contextSet.isEmpty()) {
|
||||
SpongeCommandUtils.sendPrefixed(sender, "&aShowing parents matching contexts &bANY&a.");
|
||||
Map<ImmutableContextSet, ImmutableList<LPSubjectReference>> parents = subjectData.getAllParents();
|
||||
if (parents.isEmpty()) {
|
||||
SpongeCommandUtils.sendPrefixed(sender, "That subject does not have any parents defined.");
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
for (Map.Entry<ImmutableContextSet, ImmutableList<LPSubjectReference>> e : parents.entrySet()) {
|
||||
@ -67,13 +66,11 @@ public class ParentInfo extends ChildCommand<LPSubjectData> {
|
||||
List<LPSubjectReference> parents = subjectData.getParents(contextSet);
|
||||
if (parents.isEmpty()) {
|
||||
SpongeCommandUtils.sendPrefixed(sender, "That subject does not have any parents defined in those contexts.");
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
SpongeCommandUtils.sendPrefixed(sender, "&aShowing parents matching contexts &b" +
|
||||
SpongeCommandUtils.contextToString(contextSet) + "&a.\n" + SpongeCommandUtils.parentsToString(parents));
|
||||
|
||||
}
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.sponge.commands;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -48,7 +47,7 @@ public class ParentRemove extends ChildCommand<LPSubjectData> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) {
|
||||
String collection = args.get(0);
|
||||
String name = args.get(1);
|
||||
ImmutableContextSet contextSet = args.getContextOrEmpty(2);
|
||||
@ -71,6 +70,5 @@ public class ParentRemove extends ChildCommand<LPSubjectData> {
|
||||
} else {
|
||||
SpongeCommandUtils.sendPrefixed(sender, "Unable to remove parent. Are you sure the Subject has it added?");
|
||||
}
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.sponge.commands;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -43,7 +42,7 @@ public class PermissionClear extends ChildCommand<LPSubjectData> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) {
|
||||
ImmutableContextSet contextSet = args.getContextOrEmpty(0);
|
||||
if (contextSet.isEmpty()) {
|
||||
subjectData.clearPermissions();
|
||||
@ -52,6 +51,5 @@ public class PermissionClear extends ChildCommand<LPSubjectData> {
|
||||
subjectData.clearPermissions(contextSet);
|
||||
SpongeCommandUtils.sendPrefixed(sender, "&aCleared permissions matching contexts &b" + SpongeCommandUtils.contextToString(contextSet));
|
||||
}
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ package me.lucko.luckperms.sponge.commands;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
import me.lucko.luckperms.common.command.spec.CommandSpec;
|
||||
@ -47,14 +46,14 @@ public class PermissionInfo extends ChildCommand<LPSubjectData> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) {
|
||||
ImmutableContextSet contextSet = args.getContextOrEmpty(0);
|
||||
if (contextSet.isEmpty()) {
|
||||
SpongeCommandUtils.sendPrefixed(sender, "&aShowing permissions matching contexts &bANY&a.");
|
||||
Map<ImmutableContextSet, ImmutableMap<String, Boolean>> permissions = subjectData.getAllPermissions();
|
||||
if (permissions.isEmpty()) {
|
||||
SpongeCommandUtils.sendPrefixed(sender, "That subject does not have any permissions defined.");
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
for (Map.Entry<ImmutableContextSet, ImmutableMap<String, Boolean>> e : permissions.entrySet()) {
|
||||
@ -65,13 +64,11 @@ public class PermissionInfo extends ChildCommand<LPSubjectData> {
|
||||
Map<String, Boolean> permissions = subjectData.getPermissions(contextSet);
|
||||
if (permissions.isEmpty()) {
|
||||
SpongeCommandUtils.sendPrefixed(sender, "That subject does not have any permissions defined in those contexts.");
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
SpongeCommandUtils.sendPrefixed(sender, "&aShowing permissions matching contexts &b" +
|
||||
SpongeCommandUtils.contextToString(contextSet) + "&a.\n" + SpongeCommandUtils.nodesToString(permissions));
|
||||
|
||||
}
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package me.lucko.luckperms.sponge.commands;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
import me.lucko.luckperms.common.command.access.CommandPermission;
|
||||
@ -45,7 +44,7 @@ public class PermissionSet extends ChildCommand<LPSubjectData> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) throws CommandException {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, LPSubjectData subjectData, ArgumentList args, String label) throws CommandException {
|
||||
String node = args.get(0);
|
||||
Tristate tristate = SpongeCommandUtils.parseTristate(1, args);
|
||||
ImmutableContextSet contextSet = args.getContextOrEmpty(2);
|
||||
@ -55,7 +54,5 @@ public class PermissionSet extends ChildCommand<LPSubjectData> {
|
||||
} else {
|
||||
SpongeCommandUtils.sendPrefixed(sender, "Unable to set permission. Does the Subject already have it set?");
|
||||
}
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ package me.lucko.luckperms.sponge.commands;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import me.lucko.luckperms.common.command.CommandResult;
|
||||
import me.lucko.luckperms.common.command.abstraction.ChildCommand;
|
||||
import me.lucko.luckperms.common.command.abstraction.Command;
|
||||
import me.lucko.luckperms.common.command.abstraction.CommandException;
|
||||
@ -83,7 +82,7 @@ public class SpongeParentCommand extends Command<Void> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(LuckPermsPlugin plugin, Sender sender, Void v, ArgumentList args, String label) {
|
||||
public void execute(LuckPermsPlugin plugin, Sender sender, Void v, ArgumentList args, String label) {
|
||||
LuckPermsService service = this.plugin.getService();
|
||||
|
||||
if (args.size() < 1) {
|
||||
@ -93,14 +92,14 @@ public class SpongeParentCommand extends Command<Void> {
|
||||
.sorted()
|
||||
.collect(Collectors.toList())
|
||||
));
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
String subjectCollection = args.get(0);
|
||||
|
||||
if (subjectCollection.equalsIgnoreCase("user") || subjectCollection.equalsIgnoreCase("group")) {
|
||||
SpongeCommandUtils.sendPrefixed(sender, "Please use the main LuckPerms commands to edit users and groups.");
|
||||
return CommandResult.STATE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (service.getLoadedCollections().keySet().stream().map(String::toLowerCase).noneMatch(s -> s.equalsIgnoreCase(subjectCollection))) {
|
||||
@ -123,12 +122,12 @@ public class SpongeParentCommand extends Command<Void> {
|
||||
SpongeCommandUtils.sendPrefixed(sender, "&aCurrent Subjects:\n" + SpongeCommandUtils.toCommaSep(subjects));
|
||||
}
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.size() < 4) {
|
||||
sendDetailedUsage(sender, label);
|
||||
return CommandResult.SUCCESS;
|
||||
return;
|
||||
}
|
||||
|
||||
boolean persistent = true;
|
||||
@ -140,7 +139,7 @@ public class SpongeParentCommand extends Command<Void> {
|
||||
String type = args.get(2).toLowerCase();
|
||||
if (!type.equals("permission") && !type.equals("parent") && !type.equals("option")) {
|
||||
sendDetailedUsage(sender, label);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
String cmd = args.get(3);
|
||||
@ -151,17 +150,17 @@ public class SpongeParentCommand extends Command<Void> {
|
||||
|
||||
if (sub == null) {
|
||||
sendDetailedUsage(sender, label);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sub.isAuthorized(sender)) {
|
||||
Message.COMMAND_NO_PERMISSION.send(sender);
|
||||
return CommandResult.NO_PERMISSION;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sub.getArgumentCheck().test(args.size() - 4)) {
|
||||
sub.sendDetailedUsage(sender, label);
|
||||
return CommandResult.INVALID_ARGS;
|
||||
return;
|
||||
}
|
||||
|
||||
String subjectId = args.get(1);
|
||||
@ -172,13 +171,11 @@ public class SpongeParentCommand extends Command<Void> {
|
||||
LPSubject subject = collection.loadSubject(subjectId).join();
|
||||
LPSubjectData subjectData = persistent ? subject.getSubjectData() : subject.getTransientSubjectData();
|
||||
|
||||
CommandResult result;
|
||||
try {
|
||||
result = sub.execute(plugin, sender, subjectData, args.subList(4, args.size()), label);
|
||||
sub.execute(plugin, sender, subjectData, args.subList(4, args.size()), label);
|
||||
} catch (CommandException e) {
|
||||
result = e.handle(sender, label, sub);
|
||||
e.handle(sender, label, sub);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user