The CommandAPI doesn't safeguard against paths with duplicate node names. This leads to client crashes
JorelAli opened this issue · comments
CommandAPI version
8.5.0
Minecraft version
1.19
Are you shading the CommandAPI?
No
What I did
- Register the following command:
new CommandAPICommand("broken1") .withArguments(new StringArgument("key")) .withArguments(new IntegerArgument("a")) .withArguments(new StringArgument("key")) .executesPlayer((player, objects) -> { System.out.println(objects[0] + ", " + objects[1] + ", " + objects[2]); }) .register();
- Type
/broken1 str 123 str
What actually happened
Minecraft's client (the vanilla client, not the server) crashes and closes.
What should have happened
The command should be runnable
Server logs and CommandAPI config
No response
Other
This appears to be the case when there is a "gap" between arguments. The following (with two consecutive arguments with the same key) doesn't cause a crash:
new CommandAPICommand("broken")
.withArguments(new StringArgument("key"))
.withArguments(new StringArgument("key"))
.executesPlayer((player, objects) -> {
System.out.println(objects[0] + ", " + objects[1]);
})
.register();
Fixed in 8.5.1.