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

[Suggestion] Add a method to add a collection of literals/arguments #69

Open
Emalios opened this issue May 21, 2020 · 0 comments
Open

Comments

@Emalios
Copy link

Emalios commented May 21, 2020

Hello, i use Brigadier API and i would make a thing like that :

List<RequiredArgumentBuilder> list;
for (var argument : list) {
    builder.then(argument);
}
builder.execute(myCommand);

So, i have a list of arguments, and I would like my command to be executed only after all the arguments are saved. But I did not find how.
Even if there is an existing solution in the API, it would still be handy to create two new methods that would support collections. Something like this :

    public T then(final ArgumentBuilder<S, ?>... arguments) {
        if (target != null) {
            throw new IllegalStateException("Cannot add children to a redirected node");
        }
        for (var argument : arguments) {
            this.arguments.addChild(argument.build());
        }
        return getThis();
    }

I have made a pull request here : #70

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

No branches or pull requests

1 participant