From 6e6d34905ac39bd2ed9548729041febadd42da2f Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 1 Sep 2022 17:34:49 +0200 Subject: [PATCH] Fix AbstractSWCommand register --- src/de/steamwar/command/AbstractSWCommand.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/command/AbstractSWCommand.java b/src/de/steamwar/command/AbstractSWCommand.java index e30ac7b..c23fd91 100644 --- a/src/de/steamwar/command/AbstractSWCommand.java +++ b/src/de/steamwar/command/AbstractSWCommand.java @@ -144,16 +144,20 @@ public abstract class AbstractSWCommand { for (Method method : methods) { add(Register.class, method, i -> i > 0, true, null, (anno, parameters) -> { if (!anno.help()) return; + boolean error = false; if (parameters.length != 2) { commandSystemWarning(() -> "The method '" + method.toString() + "' is lacking parameters or has too many"); + error = true; } if (!parameters[parameters.length - 1].isVarArgs()) { commandSystemWarning(() -> "The method '" + method.toString() + "' is lacking the varArgs parameters as last Argument"); + error = true; } if (parameters[parameters.length - 1].getType().getComponentType() != String.class) { commandSystemWarning(() -> "The method '" + method.toString() + "' is lacking the varArgs parameters of type '" + String.class.getTypeName() + "' as last Argument"); - return; + error = true; } + if (error) return; commandHelpList.add(new SubCommand<>(this, method, anno.value(), new HashMap<>(), new HashMap<>(), true, null, anno.noTabComplete())); });