Fix (again) command registering

This commit is contained in:
Marc Baloup 2024-07-10 21:34:03 +02:00
parent c86855ac16
commit 5a04052f8e

View File

@ -205,7 +205,7 @@ public abstract class PaperBrigadierCommand extends BrigadierCommand<CommandSour
} }
vanillaPaperDispatcher.getRoot().getChildren().removeIf(c -> c.getName().equals(aliasToForce)); vanillaPaperDispatcher.getRoot().getChildren().removeIf(c -> c.getName().equals(aliasToForce));
} }
LiteralCommandNode<CommandSourceStack> newPCN = unwrap(new PluginCommandNode(commandNode.getName(), plugin.getPluginMeta(), commandNode, description)); LiteralCommandNode<CommandSourceStack> newPCN = unwrap(new PluginCommandNode(aliasToForce, plugin.getPluginMeta(), commandNode, description));
vanillaPaperDispatcher.getRoot().addChild(newPCN); vanillaPaperDispatcher.getRoot().addChild(newPCN);
} }
}); });
@ -255,7 +255,7 @@ public abstract class PaperBrigadierCommand extends BrigadierCommand<CommandSour
else if (BukkitCommandNode.REFLECT.get().isInstance(command)) { else if (BukkitCommandNode.REFLECT.get().isInstance(command)) {
BukkitCommandNode wrappedBCN = wrap(command, BukkitCommandNode.class); BukkitCommandNode wrappedBCN = wrap(command, BukkitCommandNode.class);
Command bukkitCmd = wrappedBCN.getBukkitCommand(); Command bukkitCmd = wrappedBCN.getBukkitCommand();
if (bukkitCmd instanceof PluginCommand cmd) { if (bukkitCmd instanceof PluginCommand) {
return true; return true;
} }
else if (VanillaCommandWrapper.REFLECT.get().isInstance(bukkitCmd)) { else if (VanillaCommandWrapper.REFLECT.get().isInstance(bukkitCmd)) {