Improved logs for bukkit/brigadier command registration

This commit is contained in:
Marc Baloup 2022-12-08 14:53:39 +01:00
parent f0540a8942
commit b5035cfb59
Signed by: marcbal
GPG Key ID: BBC0FE3ABC30B893

View File

@ -78,7 +78,7 @@ public abstract class PaperBrigadierCommand extends BrigadierCommand<BukkitBriga
Command bukkitCommand = bukkitCmdMap.getCommand(name); Command bukkitCommand = bukkitCmdMap.getCommand(name);
if (bukkitCommand != null) { if (bukkitCommand != null) {
if (VanillaCommandWrapper.REFLECT.get().isInstance(bukkitCommand)) { if (VanillaCommandWrapper.REFLECT.get().isInstance(bukkitCommand)) {
Log.info("Command /" + name + " is already a vanilla command."); //Log.info("Command /" + name + " is already a vanilla command.");
return; return;
} }
Log.info("Removing Bukkit command /" + name + " (" + getCommandIdentity(bukkitCommand) + ")"); Log.info("Removing Bukkit command /" + name + " (" + getCommandIdentity(bukkitCommand) + ")");
@ -209,9 +209,13 @@ public abstract class PaperBrigadierCommand extends BrigadierCommand<BukkitBriga
nmsRegister = true; nmsRegister = true;
Log.info("Overwriting Brigadier command /" + name); Log.info("Overwriting Brigadier command /" + name);
} }
else { else if (prefixed || !isAlias) {
Log.severe("/" + name + " already in NMS Brigadier instance." Log.severe("/" + name + " already in NMS Brigadier instance."
+ " Wont replace it because registration is not forced."); + " Wont replace it because registration is not forced for prefixed or initial name of a command.");
}
else { // conflict, wont replace, not forced but only an alias anyway
Log.info("/" + name + " already in NMS Brigadier instance."
+ " Wont replace it because registration is not forced for a non-prefixed alias.");
} }
} }
else { else {
@ -243,10 +247,13 @@ public abstract class PaperBrigadierCommand extends BrigadierCommand<BukkitBriga
Log.info("Overwriting Bukkit command /" + name Log.info("Overwriting Bukkit command /" + name
+ " (" + getCommandIdentity(bukkitConflicted) + ")"); + " (" + getCommandIdentity(bukkitConflicted) + ")");
} }
else if (prefixed || !isAlias) {
Log.severe("/" + name + " already in Bukkit dispatcher (" + getCommandIdentity(bukkitConflicted) + ")." +
" Wont replace it because registration is not forced for prefixed or initial name of a command.");
}
else { else {
Log.severe("/" + name + " already in Bukkit" Log.info("/" + name + " already in Bukkit dispatcher (" + getCommandIdentity(bukkitConflicted) + ")." +
+ " dispatcher (" + getCommandIdentity(bukkitConflicted) " Wont replace it because registration is not forced for a non-prefixed alias.");
+ "). Wont replace it because registration is not forced.");
} }
} }
} }