From 6305a795417bdd618b409b2afe62a43e02211e66 Mon Sep 17 00:00:00 2001 From: Pablete1234 Date: Sat, 19 Nov 2022 20:58:06 +0100 Subject: [PATCH] Fix defaults with flags everywhere --- .../src/main/java/cloud/commandframework/CommandTree.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cloud-core/src/main/java/cloud/commandframework/CommandTree.java b/cloud-core/src/main/java/cloud/commandframework/CommandTree.java index bf9d504fb..398ed2712 100644 --- a/cloud-core/src/main/java/cloud/commandframework/CommandTree.java +++ b/cloud-core/src/main/java/cloud/commandframework/CommandTree.java @@ -339,7 +339,8 @@ private CommandTree(final @NonNull CommandManager commandManager) { )); } if (child.getValue() != null) { - if (commandQueue.isEmpty()) { + // Flag arguments need to be skipped over, so that further defaults are handled + if (commandQueue.isEmpty() && !(child.getValue() instanceof FlagArgument)) { if (child.getValue().hasDefaultValue()) { commandQueue.add(child.getValue().getDefaultValue()); } else if (!child.getValue().isRequired()) {