SteamWar/SpigotCore
Archiviert
13
0

Simplify double not on SWCommand.add

Dieser Commit ist enthalten in:
yoyosource 2021-03-30 08:28:08 +02:00
Ursprung db1198bdd9
Commit db8d9697e6

Datei anzeigen

@ -79,7 +79,7 @@ public abstract class SWCommand {
}); });
for (Method method : getClass().getDeclaredMethods()) { 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()) { if (anno.local()) {
localTypeMapper.put(anno.value(), typeMapper); localTypeMapper.put(anno.value(), typeMapper);
} else { } else {
@ -89,7 +89,7 @@ public abstract class SWCommand {
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); 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()) { if (!anno.help()) {
return; return;
} }
@ -103,7 +103,7 @@ public abstract class SWCommand {
}); });
} }
for (Method method : getClass().getDeclaredMethods()) { 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()) { if (anno.help()) {
return; return;
} }
@ -135,7 +135,7 @@ public abstract class SWCommand {
} }
Parameter[] parameters = method.getParameters(); Parameter[] parameters = method.getParameters();
if (parameterTester.test(parameters.length)) { if (!parameterTester.test(parameters.length)) {
return; return;
} }
if (firstParameter && !CommandSender.class.isAssignableFrom(parameters[0].getType())) { if (firstParameter && !CommandSender.class.isAssignableFrom(parameters[0].getType())) {