From db8d9697e6193973998f244e81419bd89b39a95c Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 30 Mar 2021 08:28:08 +0200 Subject: [PATCH] Simplify double not on SWCommand.add --- SpigotCore_Main/src/de/steamwar/command/SWCommand.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/command/SWCommand.java b/SpigotCore_Main/src/de/steamwar/command/SWCommand.java index 5488b18..d1bcdb1 100644 --- a/SpigotCore_Main/src/de/steamwar/command/SWCommand.java +++ b/SpigotCore_Main/src/de/steamwar/command/SWCommand.java @@ -79,7 +79,7 @@ public abstract class SWCommand { }); for (Method method : getClass().getDeclaredMethods()) { - addMapper(Mapper.class, method, i -> i != 0, false, TypeMapper.class, (anno, typeMapper) -> { + addMapper(Mapper.class, method, i -> i == 0, false, TypeMapper.class, (anno, typeMapper) -> { if (anno.local()) { localTypeMapper.put(anno.value(), typeMapper); } else { @@ -89,7 +89,7 @@ public abstract class SWCommand { 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; } @@ -103,7 +103,7 @@ public abstract class SWCommand { }); } for (Method method : getClass().getDeclaredMethods()) { - add(Register.class, method, i -> i == 0, true, null, (anno, parameters) -> { + add(Register.class, method, i -> i > 0, true, null, (anno, parameters) -> { if (anno.help()) { return; } @@ -135,7 +135,7 @@ public abstract class SWCommand { } Parameter[] parameters = method.getParameters(); - if (parameterTester.test(parameters.length)) { + if (!parameterTester.test(parameters.length)) { return; } if (firstParameter && !CommandSender.class.isAssignableFrom(parameters[0].getType())) {