brigadier icon indicating copy to clipboard operation
brigadier copied to clipboard

Argument node is not considered when literal is impermissible with same name

Open hugmanrique opened this issue 5 years ago • 0 comments

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

hugmanrique avatar Apr 03 '21 19:04 hugmanrique