-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Expected behavior
When redirecting aliases to a command using LiteralArgumentBuilder.redirect(LiteralCommandNode) the alias should execute said command.
Observed/Actual behavior
Aliases get sent to the client, however upon executing (without namespace) an unknown or incomplete command exception gets thrown. When using an alias without a namespace arguments don't get recognized and are marked as incorrect as well.
Steps/models to reproduce
Create a command using the brigadier API and add an alias that redirects to this command.
LiteralArgumentBuilder<CommandSourceStack> builder = Commands.literal("teleport");
builder.requires(commandSourceStack -> commandSourceStack.getSender().hasPermission("example.command.teleport"))
.then(Commands.argument("target", ArgumentTypes.player())
.executes(source -> {
Player player = source.getArgument("target", PlayerSelectorArgumentResolver.class).resolve(source.getSource()).getFirst();
source.getSource().getSender().sendMessage("Teleporting to %s".formatted(player.getName()));
return 1;
}));
LiteralCommandNode<CommandSourceStack> literalCommandNode = builder.build();
commands.register(javaPlugin.getPluginMeta(), literalCommandNode, "Teleport command", Collections.emptySet());
commands.register(javaPlugin.getPluginMeta(), Commands.literal("tp").redirect(literalCommandNode).build(), "Teleport command", Collections.emptySet());Try to run this command by using the alias without namespace: Arguments are marked as incorrect and Unknown or incomplete command
Plugin and Datapack List
Paper version
30.05 01:35:37 [Server] INFO This server is running Paper version 1.20.6-121-master@a31dc90 (2024-05-29T21:07:31Z) (Implementing API version 1.20.6-R0.1-SNAPSHOT)
30.05 01:35:37 [Server] INFO You are 3 version(s) behind
30.05 01:35:37 [Server] INFO Download the new version at: https://papermc.io/downloads/paper
30.05 01:35:37 [Server] INFO Previous version: 1.20.6-115-9d6f2cc (MC: 1.20.6)
Other
No response
Metadata
Metadata
Assignees
Labels
Type
Fields
Give feedbackProjects
Status

