Skip to content

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

@Emalios

Description

@Emalios

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions