Add collection support to ArgumentBuilder.then to support
multiples Arguments/CommandsNode
This commit is contained in:
parent
559d8f3972
commit
383ac0b1a3
1 changed files with 10 additions and 4 deletions
|
@ -23,19 +23,25 @@ public abstract class ArgumentBuilder<S, T extends ArgumentBuilder<S, T>> {
|
|||
|
||||
protected abstract T getThis();
|
||||
|
||||
public T then(final ArgumentBuilder<S, ?> argument) {
|
||||
@SafeVarargs
|
||||
public final T then(final ArgumentBuilder<S, ?>... arguments) {
|
||||
if (target != null) {
|
||||
throw new IllegalStateException("Cannot add children to a redirected node");
|
||||
}
|
||||
arguments.addChild(argument.build());
|
||||
for (ArgumentBuilder<S, ?> argument : arguments) {
|
||||
this.arguments.addChild(argument.build());
|
||||
}
|
||||
return getThis();
|
||||
}
|
||||
|
||||
public T then(final CommandNode<S> argument) {
|
||||
@SafeVarargs
|
||||
public final T then(final CommandNode<S>... arguments) {
|
||||
if (target != null) {
|
||||
throw new IllegalStateException("Cannot add children to a redirected node");
|
||||
}
|
||||
arguments.addChild(argument);
|
||||
for (CommandNode<S> argument : arguments) {
|
||||
this.arguments.addChild(argument);
|
||||
}
|
||||
return getThis();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue