From c9e8b31aa4c5b57d313f1793f4c8d74dbf7c2abe Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 30 Mar 2021 13:50:16 +0200 Subject: [PATCH] Fix SWCommand add HelpRegisters --- SpigotCore_Main/src/de/steamwar/command/SWCommand.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/command/SWCommand.java b/SpigotCore_Main/src/de/steamwar/command/SWCommand.java index 3aa9668..cc963a1 100644 --- a/SpigotCore_Main/src/de/steamwar/command/SWCommand.java +++ b/SpigotCore_Main/src/de/steamwar/command/SWCommand.java @@ -87,13 +87,16 @@ public abstract class SWCommand { SWCommandUtils.addMapper(anno.value(), typeMapper); } }); - addMapper(ClassMapper.class, method, i -> i != 0, false, TypeMapper.class, (anno, typeMapper) -> { + addMapper(ClassMapper.class, method, i -> i == 0, false, TypeMapper.class, (anno, typeMapper) -> { SWCommandUtils.addMapper(anno.value().getTypeName(), typeMapper); }); - add(Register.class, method, i -> i == 2, true, null, (anno, parameters) -> { + add(Register.class, method, i -> i > 2, true, null, (anno, parameters) -> { if (!anno.help()) { return; } + if (parameters.length != 2) { + Bukkit.getLogger().log(Level.WARNING, "The method '" + method.toString() + "' is lacking parameters or has too many"); + } if (!parameters[parameters.length - 1].isVarArgs()) { Bukkit.getLogger().log(Level.WARNING, "The method '" + method.toString() + "' is lacking the varArgs parameters as last Argument"); return;