From 68c20d9e9a2fb1ad7cee5c2696af2f1af13fc5f8 Mon Sep 17 00:00:00 2001 From: William Date: Sat, 25 Mar 2023 17:24:34 +0000 Subject: [PATCH] Fix error registering disabled commands --- .../main/java/net/william278/huskhomes/BukkitHuskHomes.java | 2 +- .../net/william278/huskhomes/command/DisabledCommand.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bukkit/src/main/java/net/william278/huskhomes/BukkitHuskHomes.java b/bukkit/src/main/java/net/william278/huskhomes/BukkitHuskHomes.java index 8f2c9e75..86717bee 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/BukkitHuskHomes.java +++ b/bukkit/src/main/java/net/william278/huskhomes/BukkitHuskHomes.java @@ -140,7 +140,7 @@ public class BukkitHuskHomes extends JavaPlugin implements HuskHomes, BukkitTask .map(type -> { final Command command = type.getCommand(); if (settings.isCommandDisabled(command)) { - new BukkitCommand(new DisabledCommand(this), this).register(); + new BukkitCommand(new DisabledCommand(command.getName(), this), this).register(); return null; } else { new BukkitCommand(command, this).register(); diff --git a/common/src/main/java/net/william278/huskhomes/command/DisabledCommand.java b/common/src/main/java/net/william278/huskhomes/command/DisabledCommand.java index da7d1d5f..52e002b7 100644 --- a/common/src/main/java/net/william278/huskhomes/command/DisabledCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/DisabledCommand.java @@ -8,8 +8,9 @@ import java.util.List; public class DisabledCommand extends Command { - public DisabledCommand(@NotNull HuskHomes plugin) { - super("", List.of(), "", plugin); + public DisabledCommand(@NotNull String name, @NotNull HuskHomes plugin) { + super(name, List.of(), "", plugin); + setOperatorCommand(true); } @Override @@ -17,4 +18,5 @@ public class DisabledCommand extends Command { plugin.getLocales().getLocale("error_command_disabled") .ifPresent(executor::sendMessage); } + }