From 50f5ab671aba42934f79983cef85be61df406dcc Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Wed, 10 Jul 2024 22:28:47 +0200 Subject: [PATCH] Debug better the alias registration forcing --- .../pandacube/lib/paper/commands/PaperBrigadierCommand.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/commands/PaperBrigadierCommand.java b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/commands/PaperBrigadierCommand.java index 3a47606..b24e517 100644 --- a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/commands/PaperBrigadierCommand.java +++ b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/commands/PaperBrigadierCommand.java @@ -191,20 +191,22 @@ public abstract class PaperBrigadierCommand extends BrigadierCommand actualNode = vanillaPaperDispatcher.getRoot().getChild(aliasToForce); if (actualNode != null) { + Log.info("Forcing registration of alias /" + aliasToForce + " for command /" + commandNode.getName() + ": replacing " + getCommandIdentity(actualNode) + "?"); if (PluginCommandNode.REFLECT.get().isInstance(actualNode)) { PluginCommandNode pcn = wrap(actualNode, PluginCommandNode.class); if (pcn.getPlugin().equals(plugin)) return; - Log.info(getCommandIdentity(actualNode) + " found in the dispatcher. Replacing it by force."); } else if (BukkitCommandNode.REFLECT.get().isInstance(actualNode)) { BukkitCommandNode bcn = wrap(actualNode, BukkitCommandNode.class); if (bcn.getBukkitCommand() instanceof PluginCommand pc && pc.getPlugin().equals(plugin)) return; - Log.info(getCommandIdentity(actualNode) + " found in the dispatcher. Replacing it by force."); } vanillaPaperDispatcher.getRoot().getChildren().removeIf(c -> c.getName().equals(aliasToForce)); } + else { + Log.info("Forcing registration of alias /" + aliasToForce + " for command /" + commandNode.getName() + ": no command found for alias. Adding alias."); + } LiteralCommandNode newPCN = unwrap(new PluginCommandNode(aliasToForce, plugin.getPluginMeta(), commandNode, description)); vanillaPaperDispatcher.getRoot().addChild(newPCN); }