Add /lp reloadconfig command - closes #100

This commit is contained in:
Luck 2017-01-21 20:14:25 +00:00
parent b7cf0e6bc7
commit 0a3ca3affe
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
5 changed files with 52 additions and 0 deletions

View File

@ -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.ImportCommand;
import me.lucko.luckperms.common.commands.misc.InfoCommand; import me.lucko.luckperms.common.commands.misc.InfoCommand;
import me.lucko.luckperms.common.commands.misc.NetworkSyncCommand; 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.SearchCommand;
import me.lucko.luckperms.common.commands.misc.SyncCommand; import me.lucko.luckperms.common.commands.misc.SyncCommand;
import me.lucko.luckperms.common.commands.misc.VerboseCommand; import me.lucko.luckperms.common.commands.misc.VerboseCommand;
@ -91,6 +92,7 @@ public class CommandManager {
.add(new NetworkSyncCommand()) .add(new NetworkSyncCommand())
.add(new ImportCommand()) .add(new ImportCommand())
.add(new ExportCommand()) .add(new ExportCommand())
.add(new ReloadConfigCommand())
.add(new MigrationMainCommand()) .add(new MigrationMainCommand())
.add(new UsersBulkEditMainCommand()) .add(new UsersBulkEditMainCommand())
.add(new CreateGroup()) .add(new CreateGroup())

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
*
* 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<String> args, String label) throws CommandException {
plugin.getConfiguration().reload();
Message.RELOAD_CONFIG_SUCCESS.send(sender);
return CommandResult.SUCCESS;
}
}

View File

@ -136,6 +136,7 @@ public enum Message {
UPDATE_TASK_COMPLETE_NETWORK("&aUpdate task finished. Now attempting to push to other servers.", true), 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_SUCCESS("&aOther servers were notified successfully.", true),
UPDATE_TASK_PUSH_FAILURE("&cError whilst pushing changes to other servers. Is Redis enabled?", 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( INFO(
"{PREFIX}&2Running &bLuckPerms v{0}&2 by &bLuck&2." + "\n" + "{PREFIX}&2Running &bLuckPerms v{0}&2 by &bLuck&2." + "\n" +
"{PREFIX}&f- &3Platform: &f{1}" + "\n" + "{PREFIX}&f- &3Platform: &f{1}" + "\n" +

View File

@ -41,6 +41,7 @@ public enum Permission {
VERBOSE(list("verbose"), Type.NONE), VERBOSE(list("verbose"), Type.NONE),
IMPORT(list("import"), Type.NONE), IMPORT(list("import"), Type.NONE),
EXPORT(list("export"), Type.NONE), EXPORT(list("export"), Type.NONE),
RELOAD_CONFIG(list("reloadconfig"), Type.NONE),
MIGRATION(list("migration"), Type.NONE), MIGRATION(list("migration"), Type.NONE),
CREATE_GROUP(list("creategroup"), Type.NONE), CREATE_GROUP(list("creategroup"), Type.NONE),

View File

@ -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-complete-network: "&aUpdate task finished. Now attempting to push to other servers."
update-task-push-success: "&aOther servers were notified successfully." update-task-push-success: "&aOther servers were notified successfully."
update-task-push-failure: "&cError whilst pushing changes to other servers. Is Redis enabled?" 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: > info: >
{PREFIX}&2Running &bLuckPerms v{0}&2 by &bLuck&2.\n {PREFIX}&2Running &bLuckPerms v{0}&2 by &bLuck&2.\n
{PREFIX}&f- &3Platform: &f{1}\n {PREFIX}&f- &3Platform: &f{1}\n