diff --git a/api/src/main/java/com/lishid/openinv/util/setting/Toggles.java b/api/src/main/java/com/lishid/openinv/util/setting/Toggles.java index d7e8f956..cd6b53df 100644 --- a/api/src/main/java/com/lishid/openinv/util/setting/Toggles.java +++ b/api/src/main/java/com/lishid/openinv/util/setting/Toggles.java @@ -12,8 +12,8 @@ public final class Toggles { private static final Map TOGGLES = new HashMap<>(); - private static final PlayerToggle ANY = add(new MemoryToggle("AnyContainer")); - private static final PlayerToggle SILENT = add(new MemoryToggle("SilentContainer")); + private static final PlayerToggle ANY = add(new MemoryToggle("anycontainer")); + private static final PlayerToggle SILENT = add(new MemoryToggle("silentcontainer")); public static @NotNull PlayerToggle any() { return ANY; diff --git a/plugin/src/main/java/com/lishid/openinv/command/ContainerSettingCommand.java b/plugin/src/main/java/com/lishid/openinv/command/ContainerSettingCommand.java index f07e13fa..62324597 100644 --- a/plugin/src/main/java/com/lishid/openinv/command/ContainerSettingCommand.java +++ b/plugin/src/main/java/com/lishid/openinv/command/ContainerSettingCommand.java @@ -26,6 +26,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.command.TabExecutor; import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; import org.jetbrains.annotations.NotNull; import java.util.Collections; @@ -48,8 +49,14 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command return true; } - boolean any = command.getName().startsWith("any"); - PlayerToggle toggle = any ? Toggles.any() : Toggles.silent(); + PlayerToggle toggle = Toggles.get(command.getName()); + + // Shouldn't be possible. + if (toggle == null) { + JavaPlugin.getProvidingPlugin(getClass()).getLogger().warning("Command /" + command.getName() + " registered with no corresponding toggle!"); + return false; + } + UUID playerId = player.getUniqueId(); if (args.length > 0) {