From 15c6c8a2a13e3cb0be71d368a4354a3ac5423cf4 Mon Sep 17 00:00:00 2001 From: jmp Date: Sat, 17 Oct 2020 18:59:22 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Suggest=20the=20right=20amount?= =?UTF-8?q?=20of=20arguments=20with=20>1=20requestedArgumentCount?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cloud/commandframework/CommandTree.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cloud-core/src/main/java/cloud/commandframework/CommandTree.java b/cloud-core/src/main/java/cloud/commandframework/CommandTree.java index f18d0509..f4f06395 100644 --- a/cloud-core/src/main/java/cloud/commandframework/CommandTree.java +++ b/cloud-core/src/main/java/cloud/commandframework/CommandTree.java @@ -449,7 +449,6 @@ public final class CommandTree { // The value has to be a variable final Node> child = children.get(0); - // START: Compound arguments /* When we get in here, we need to treat compound arguments a little differently */ if (child.getValue() instanceof CompoundArgument) { @SuppressWarnings("unchecked") final CompoundArgument compoundArgument = (CompoundArgument) child @@ -474,8 +473,10 @@ public final class CommandTree { while (commandQueue.size() > 1) { commandQueue.remove(); } - } else if (child.getValue() != null) { - for (int i = 0; i < child.getValue().getParser().getRequestedArgumentCount() - 1 && commandQueue.size()> 1; i++) { + } else if (child.getValue() != null + && commandQueue.size() <= child.getValue().getParser().getRequestedArgumentCount()) { + for (int i = 0; i < child.getValue().getParser().getRequestedArgumentCount() - 1 + && commandQueue.size() > 1; i++) { commandContext.store( String.format("%s_%d", child.getValue().getName(), i), commandQueue.remove()