From a43e148d93f808cac1d1dfe3544da8cbc6f5b4ef Mon Sep 17 00:00:00 2001 From: Jikoo Date: Sun, 28 Jul 2024 09:15:57 -0400 Subject: [PATCH] Register toggle commands automatically Reduce the number of places I have to remember to edit things --- plugin/src/main/java/com/lishid/openinv/OpenInv.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugin/src/main/java/com/lishid/openinv/OpenInv.java b/plugin/src/main/java/com/lishid/openinv/OpenInv.java index d583e450..55597a1e 100644 --- a/plugin/src/main/java/com/lishid/openinv/OpenInv.java +++ b/plugin/src/main/java/com/lishid/openinv/OpenInv.java @@ -142,7 +142,11 @@ public void onEnable() { this.setCommandExecutor(new SearchContainerCommand(this, languageManager), "searchcontainer"); this.setCommandExecutor(new SearchInvCommand(languageManager), "searchinv", "searchender"); this.setCommandExecutor(new SearchEnchantCommand(languageManager), "searchenchant"); - this.setCommandExecutor(new ContainerSettingCommand(languageManager), "silentcontainer", "anycontainer"); + + ContainerSettingCommand settingCommand = new ContainerSettingCommand(languageManager); + for (PlayerToggle toggle : PlayerToggles.get()) { + setCommandExecutor(settingCommand, toggle.getName()); + } } else { this.sendVersionError(this.getLogger()::warning);