diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/CommandManager.java b/common/src/main/java/me/lucko/luckperms/common/commands/CommandManager.java index 8f9d9e63..8b4900e9 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/CommandManager.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/CommandManager.java @@ -37,6 +37,7 @@ import me.lucko.luckperms.common.commands.misc.ExportCommand; import me.lucko.luckperms.common.commands.misc.ImportCommand; import me.lucko.luckperms.common.commands.misc.InfoCommand; import me.lucko.luckperms.common.commands.misc.NetworkSyncCommand; +import me.lucko.luckperms.common.commands.misc.ReloadConfigCommand; import me.lucko.luckperms.common.commands.misc.SearchCommand; import me.lucko.luckperms.common.commands.misc.SyncCommand; import me.lucko.luckperms.common.commands.misc.VerboseCommand; @@ -91,6 +92,7 @@ public class CommandManager { .add(new NetworkSyncCommand()) .add(new ImportCommand()) .add(new ExportCommand()) + .add(new ReloadConfigCommand()) .add(new MigrationMainCommand()) .add(new UsersBulkEditMainCommand()) .add(new CreateGroup()) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/misc/ReloadConfigCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/misc/ReloadConfigCommand.java new file mode 100644 index 00000000..6830d0b2 --- /dev/null +++ b/common/src/main/java/me/lucko/luckperms/common/commands/misc/ReloadConfigCommand.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2016 Lucko (Luck) + * + * 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.commands.misc; + +import me.lucko.luckperms.common.LuckPermsPlugin; +import me.lucko.luckperms.common.commands.CommandException; +import me.lucko.luckperms.common.commands.CommandResult; +import me.lucko.luckperms.common.commands.SingleCommand; +import me.lucko.luckperms.common.commands.sender.Sender; +import me.lucko.luckperms.common.constants.Message; +import me.lucko.luckperms.common.constants.Permission; +import me.lucko.luckperms.common.utils.Predicates; + +import java.util.List; + +public class ReloadConfigCommand extends SingleCommand { + public ReloadConfigCommand() { + super("ReloadConfig", "Reload some of the config options", "/%s reloadconfig", Permission.RELOAD_CONFIG, Predicates.alwaysFalse(), null); + } + + @Override + public CommandResult execute(LuckPermsPlugin plugin, Sender sender, List args, String label) throws CommandException { + plugin.getConfiguration().reload(); + Message.RELOAD_CONFIG_SUCCESS.send(sender); + return CommandResult.SUCCESS; + } +} diff --git a/common/src/main/java/me/lucko/luckperms/common/constants/Message.java b/common/src/main/java/me/lucko/luckperms/common/constants/Message.java index efcb7f65..6fa889e4 100644 --- a/common/src/main/java/me/lucko/luckperms/common/constants/Message.java +++ b/common/src/main/java/me/lucko/luckperms/common/constants/Message.java @@ -136,6 +136,7 @@ public enum Message { UPDATE_TASK_COMPLETE_NETWORK("&aUpdate task finished. Now attempting to push to other servers.", true), UPDATE_TASK_PUSH_SUCCESS("&aOther servers were notified successfully.", true), UPDATE_TASK_PUSH_FAILURE("&cError whilst pushing changes to other servers. Is Redis enabled?", true), + RELOAD_CONFIG_SUCCESS("&aThe configuration file was reloaded. &7(some options will only apply after the server has restarted.)", true), INFO( "{PREFIX}&2Running &bLuckPerms v{0}&2 by &bLuck&2." + "\n" + "{PREFIX}&f- &3Platform: &f{1}" + "\n" + diff --git a/common/src/main/java/me/lucko/luckperms/common/constants/Permission.java b/common/src/main/java/me/lucko/luckperms/common/constants/Permission.java index a3281fd7..2f1d2746 100644 --- a/common/src/main/java/me/lucko/luckperms/common/constants/Permission.java +++ b/common/src/main/java/me/lucko/luckperms/common/constants/Permission.java @@ -41,6 +41,7 @@ public enum Permission { VERBOSE(list("verbose"), Type.NONE), IMPORT(list("import"), Type.NONE), EXPORT(list("export"), Type.NONE), + RELOAD_CONFIG(list("reloadconfig"), Type.NONE), MIGRATION(list("migration"), Type.NONE), CREATE_GROUP(list("creategroup"), Type.NONE), diff --git a/default-lang.yml b/default-lang.yml index 8a64d3b1..4a98986f 100644 --- a/default-lang.yml +++ b/default-lang.yml @@ -94,6 +94,7 @@ update-task-complete: "&aUpdate task finished." update-task-complete-network: "&aUpdate task finished. Now attempting to push to other servers." update-task-push-success: "&aOther servers were notified successfully." update-task-push-failure: "&cError whilst pushing changes to other servers. Is Redis enabled?" +reload-config-success: "&aThe configuration file was reloaded. &7(some options will only apply after the server has restarted.)" info: > {PREFIX}&2Running &bLuckPerms v{0}&2 by &bLuck&2.\n {PREFIX}&f- &3Platform: &f{1}\n