diff --git a/bukkit/src/main/java/io/tebex/plugin/TebexPlugin.java b/bukkit/src/main/java/io/tebex/plugin/TebexPlugin.java index 2e97278..b4da508 100644 --- a/bukkit/src/main/java/io/tebex/plugin/TebexPlugin.java +++ b/bukkit/src/main/java/io/tebex/plugin/TebexPlugin.java @@ -130,7 +130,9 @@ public void onEnable() { bukkitCommandMap.setAccessible(true); CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer()); - commandMap.register(getPlatformConfig().getBuyCommandName(), new BuyCommand(getPlatformConfig().getBuyCommandName(), this)); + if (config.isBuyCommandEnabled()) { + commandMap.register(getPlatformConfig().getBuyCommandName(), new BuyCommand(getPlatformConfig().getBuyCommandName(), this)); + } } catch (NoSuchFieldException | IllegalAccessException e) { throw new RuntimeException("Failed to get the CommandMap", e); } diff --git a/fabric/src/main/java/io/tebex/plugin/manager/CommandManager.java b/fabric/src/main/java/io/tebex/plugin/manager/CommandManager.java index dd743ca..cbfc984 100644 --- a/fabric/src/main/java/io/tebex/plugin/manager/CommandManager.java +++ b/fabric/src/main/java/io/tebex/plugin/manager/CommandManager.java @@ -48,8 +48,10 @@ public void register(CommandDispatcher dispatcher) { return 1; }); - BuyCommand buyCommand = new BuyCommand(platform); - dispatcher.register(literal(platform.getPlatformConfig().getBuyCommandName()).executes(buyCommand::execute)); + if (platform.getPlatformConfig().isBuyCommandEnabled()) { + BuyCommand buyCommand = new BuyCommand(platform); + dispatcher.register(literal(platform.getPlatformConfig().getBuyCommandName()).executes(buyCommand::execute)); + } commands.forEach(command -> { LiteralArgumentBuilder subCommand = literal(command.getName());