From 2ea09eadb27985a13548f5a60059969eb26d2f6b Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Tue, 27 Oct 2026 07:40:06 +0100 Subject: [PATCH] Fix command errors being hidden by generic help (#513) Commands ending in a String... parameter are treated as help commands. When such a command failed with an @ErrorMessage (e.g. /msg or /kick with an offline player), the generic help matched next, printed the usage and the collected error was never shown. Stop before generic help (noTabComplete) if an earlier help command already collected errors, and print those instead. --- .../src/de/steamwar/command/AbstractSWCommand.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CommandFramework/src/de/steamwar/command/AbstractSWCommand.java b/CommandFramework/src/de/steamwar/command/AbstractSWCommand.java index 7ec88017..5062319f 100644 --- a/CommandFramework/src/de/steamwar/command/AbstractSWCommand.java +++ b/CommandFramework/src/de/steamwar/command/AbstractSWCommand.java @@ -91,9 +91,13 @@ public abstract class AbstractSWCommand { if (commandList.stream().noneMatch(s -> s.invoke(errors::add, sender, alias, args))) { errors.forEach(Runnable::run); } else return; - if (errors.isEmpty() && helpCommandList.stream().noneMatch(s -> s.invoke(errors::add, sender, alias, args))) { - errors.forEach(Runnable::run); + if (!errors.isEmpty()) return; + for (SubCommand help : helpCommandList) { + // Generic help must not hide the error of a more specific command + if (help.noTabComplete && !errors.isEmpty()) break; + if (help.invoke(errors::add, sender, alias, args)) return; } + errors.forEach(Runnable::run); } catch (CommandFrameworkException e) { commandSystemError(sender, e); throw e;