8000 Make the CommandAPI complain less about command registered in the plu… · CommandAPI/CommandAPI@9a2315e · GitHub
[go: up one dir, main page]

Skip to content

Commit 9a2315e

Browse files 8000
authored
Make the CommandAPI complain less about command registered in the plugin.yml (#391)
* Make the CommandAPI only complain about commands registered in the plugin.yml if the plugin.yml belongs to the plugin calling the CommandAPI * still log an information that the command is registered by Bukkit * make the information about a command being registered by Bukkit not dependent of verbose outputs * include plugin name in the information message
1 parent 54df1e4 commit 9a2315e

File tree

1 file changed

+10
-2
lines changed
  • commandapi-platforms/commandapi-bukkit/commandapi-bukkit-core/src/main/java/dev/jorel/commandapi

1 file changed

+10
-2
lines changed

commandapi-platforms/commandapi-bukkit/commandapi-bukkit-core/src/main/java/dev/jorel/commandapi/CommandAPIBukkit.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,10 +378,18 @@ public void preCommandRegistration(String commandName) {
378378
// Warn if the command we're registering already exists in this plugin's
379379
// plugin.yml file
380380
final PluginCommand pluginCommand = Bukkit.getPluginCommand(commandName);
381-
if (pluginCommand != null) {
381+
if (pluginCommand == null) {
382+
return;
383+
}
384+
String pluginName = pluginCommand.getPlugin().getName();
385+
if (config.getPlugin().getName().equals(pluginName)) {
382386
CommandAPI.logWarning(
383387
"Plugin command /%s is registered by Bukkit (%s). Did you forget to remove this from your plugin.yml file?"
384-
.formatted(commandName, pluginCommand.getPlugin().getName()));
388+
.formatted(commandName, pluginName));
389+
} else {
390+
CommandAPI.logNormal(
391+
"Plugin command /%s is registered by Bukkit (%s). You may have to use /minecraft:%s to execute your command."
392+
.formatted(commandName, pluginName, commandName));
385393
}
386394
}
387395

0 commit comments

Comments
 (0)
0