From 364bb129062f21abaaff4058e8735acb97e4664d Mon Sep 17 00:00:00 2001 From: John Paul Rutigliano Date: Mon, 21 Jun 2021 10:22:25 -0400 Subject: [PATCH] Add `/essentialcommands config reload` Change tpa/tpaccept/tpdeny perms to match permissions.md. --- .../EssentialCommandRegistry.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/fibermc/essentialcommands/EssentialCommandRegistry.java b/src/main/java/com/fibermc/essentialcommands/EssentialCommandRegistry.java index c25cce54..208c2aa8 100644 --- a/src/main/java/com/fibermc/essentialcommands/EssentialCommandRegistry.java +++ b/src/main/java/com/fibermc/essentialcommands/EssentialCommandRegistry.java @@ -46,18 +46,18 @@ public static void register() { if (Config.ENABLE_TPA) { tpAskBuilder.then( argument("target", EntityArgumentType.player()) - .requires(ECPerms.require("essentialcommands.tpa.ask", 0)) + .requires(ECPerms.require("essentialcommands.tpa", 0)) .executes(new TeleportAskCommand())); tpAcceptBuilder.then( argument("target", EntityArgumentType.player()) - .requires(ECPerms.require("essentialcommands.tpa.accept", 0)) + .requires(ECPerms.require("essentialcommands.tpaccept", 0)) .suggests(TeleportResponseSuggestion.suggestedStrings()) .executes(new TeleportAcceptCommand())); tpDenyBuilder.then( argument("target", EntityArgumentType.player()) - .requires(ECPerms.require("essentialcommands.tpa.deny", 0)) + .requires(ECPerms.require("essentialcommands.tpdeny", 0)) .suggests(TeleportResponseSuggestion.suggestedStrings()) .executes(new TeleportDenyCommand())); } else { @@ -203,10 +203,26 @@ public static void register() { essentialCommandsRootNode.addChild(tpDenyNode); essentialCommandsRootNode.addChild(homeNode); essentialCommandsRootNode.addChild(backNode); + + LiteralCommandNode configNode = CommandManager.literal("config").build(); + + LiteralCommandNode configReloadNode = CommandManager.literal("reload") + .executes((context) -> { + Config.loadOrCreateProperties(); + context.getSource().sendFeedback( + new LiteralText("[Essential Commands] Config Reloaded."), + true + ); + return 1; + }).requires( + ECPerms.require("essentialcommands.config.reload", 4) + ).build(); + configNode.addChild(configReloadNode); + essentialCommandsRootNode.addChild(configNode); rootNode.addChild(essentialCommandsRootNode); //TODO if commands are disbleed, don't register them at all // @body this allows users to modify EssentialCommands functionality - // @body so that it does not conflict with their other mods/config. + // @body so that it does` not conflict with their other mods/config. } ); }