Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hugmanrique opened this issue Apr 3, 2021 · 0 comments · May be fixed by #88
Open

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

hugmanrique opened this issue Apr 3, 2021 · 0 comments · May be fixed by #88

Comments

@hugmanrique
Copy link

hugmanrique commented Apr 3, 2021

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 added a commit to hugmanrique/brigadier that referenced this issue Apr 3, 2021
hugmanrique added a commit to hugmanrique/brigadier that referenced this issue Apr 3, 2021
hugmanrique added a commit to hugmanrique/brigadier that referenced this issue Apr 3, 2021
@hugmanrique hugmanrique linked a pull request Apr 3, 2021 that will close this issue
hugmanrique added a commit to hugmanrique/brigadier that referenced this issue Apr 3, 2021
kashike pushed a commit to PaperMC/velocity-brigadier that referenced this issue May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant