You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, when I try to execute the command with a single integer argument (via goal 1) an exception is thrown!
com.mojang.brigadier.exceptions.CommandSyntaxException: Unknown command at position 6: goal 1<--[HERE]
at com.mojang.brigadier.exceptions.SimpleCommandExceptionType.createWithContext(SimpleCommandExceptionType.java:21)
at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:283)
at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:178)
at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:143)
...
Both the 2-arg and 3-arg usages work as intended:
The text was updated successfully, but these errors were encountered:
Interesting.
the CommandDispatcher when parsing looks at all child nodes and tries to parse the first node and add it to potential commands. When the node could not parse, it also collects the exceptions in a list. However, in this case we have 3 integer arguments as child of the literal. Of course, all 3 children will parse without any exceptions.
Later on, the parsing method will try to find the best child. When doing so, it prefers children that parsed the complete command string and then, children that did collect exceptions.
In this case, all 3 children will be evaluated to be suitable.
This means that your example is, as far the command parser is conserned, just as ambiguous as the following would be:
Maybe the parse-method should already collect an exception, when the command is not executable and the reader doesn't have anything to read anymore, rather than leaving that for the execute-method.
Consider the following command tree:
This should have 3 possible usages
However, when I try to execute the command with a single integer argument (via
goal 1
) an exception is thrown!Both the 2-arg and 3-arg usages work as intended:
![Chat Output](https://camo.githubusercontent.com/0f069dc1e2c2458a5c594986583756b898aabf26e79424597ffe4f4a1379071f/68747470733a2f2f692e696d6775722e636f6d2f4b6c5041504c332e706e67)
The text was updated successfully, but these errors were encountered: