🐛 Suggest the right amount of arguments with >1 requestedArgumentCount

This commit is contained in:
jmp 2020-10-17 18:59:22 -07:00 committed by Alexander Söderberg
parent 79aefb05b5
commit 15c6c8a2a1

View file

@ -449,7 +449,6 @@ public final class CommandTree<C> {
// The value has to be a variable // The value has to be a variable
final Node<CommandArgument<C, ?>> child = children.get(0); final Node<CommandArgument<C, ?>> child = children.get(0);
// START: Compound arguments
/* When we get in here, we need to treat compound arguments a little differently */ /* When we get in here, we need to treat compound arguments a little differently */
if (child.getValue() instanceof CompoundArgument) { if (child.getValue() instanceof CompoundArgument) {
@SuppressWarnings("unchecked") final CompoundArgument<?, C, ?> compoundArgument = (CompoundArgument<?, C, ?>) child @SuppressWarnings("unchecked") final CompoundArgument<?, C, ?> compoundArgument = (CompoundArgument<?, C, ?>) child
@ -474,8 +473,10 @@ public final class CommandTree<C> {
while (commandQueue.size() > 1) { while (commandQueue.size() > 1) {
commandQueue.remove(); commandQueue.remove();
} }
} else if (child.getValue() != null) { } else if (child.getValue() != null
for (int i = 0; i < child.getValue().getParser().getRequestedArgumentCount() - 1 && commandQueue.size()> 1; i++) { && commandQueue.size() <= child.getValue().getParser().getRequestedArgumentCount()) {
for (int i = 0; i < child.getValue().getParser().getRequestedArgumentCount() - 1
&& commandQueue.size() > 1; i++) {
commandContext.store( commandContext.store(
String.format("%s_%d", child.getValue().getName(), i), String.format("%s_%d", child.getValue().getName(), i),
commandQueue.remove() commandQueue.remove()