brigadier
brigadier copied to clipboard
Argument node is not considered when literal is impermissible with same name
Consider a literal that has two children: a literal called bar, and an argument node of type StringArgumentType.word(). The literal is impermissible, i.e. the requirement returns false, while the argument node has a non-null Command. That is,
subject.register(literal("foo")
.then(
literal("bar")
.requires(source -> false)
)
.then(
argument("argument", StringArgumentType.word())
.executes(command)
)
);
Now, executing foo bar will fail with Incorrect argument for command at position 4: foo <--[HERE] since the dispatcher doesn't consider the argument nodes as a fallback when the literal requirements are not met. Is this by design?
Failing test
Edit: I'm working on a PR