12
0

Fix SWCommand error message

Dieser Commit ist enthalten in:
yoyosource 2021-05-15 11:46:46 +02:00
Ursprung 96630e13d2
Commit 4d1b73dafc

Datei anzeigen

@ -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<String> 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");
}