From 4d1b73dafc8f47208276c1e5703531edb38d507a Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 15 May 2021 11:46:46 +0200 Subject: [PATCH] Fix SWCommand error message --- SpigotCore_Main/src/de/steamwar/command/SWCommand.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SpigotCore_Main/src/de/steamwar/command/SWCommand.java b/SpigotCore_Main/src/de/steamwar/command/SWCommand.java index 14bb850..35779c5 100644 --- a/SpigotCore_Main/src/de/steamwar/command/SWCommand.java +++ b/SpigotCore_Main/src/de/steamwar/command/SWCommand.java @@ -79,9 +79,12 @@ public abstract class SWCommand { addMapper(ClassMapper.class, method, i -> i == 0, false, TypeMapper.class, (anno, typeMapper) -> { (anno.local() ? localTypeMapper : SWCommandUtils.MAPPER_FUNCTIONS).putIfAbsent(anno.value().getTypeName(), typeMapper); }); - add(Register.class, method, i -> i != 2, true, null, (anno, parameters) -> { + add(Register.class, method, i -> i > 0, true, null, (anno, parameters) -> { if (!anno.help()) return; List errors = new ArrayList<>(); + if (parameters.length != 2) { + errors.add("The method '" + method.toString() + "' is lacking parameters or has too many"); + } if (!parameters[parameters.length - 1].isVarArgs()) { errors.add("The method '" + method.toString() + "' is lacking the varArgs parameters as last Argument"); }