Fix AbstractSWCommand register
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-09-01 17:34:49 +02:00
Ursprung 211f6258b5
Commit 6e6d34905a

Datei anzeigen

@ -144,16 +144,20 @@ public abstract class AbstractSWCommand<T> {
for (Method method : methods) {
add(Register.class, method, i -> i > 0, true, null, (anno, parameters) -> {
if (!anno.help()) return;
boolean error = false;
if (parameters.length != 2) {
commandSystemWarning(() -> "The method '" + method.toString() + "' is lacking parameters or has too many");
error = true;
}
if (!parameters[parameters.length - 1].isVarArgs()) {
commandSystemWarning(() -> "The method '" + method.toString() + "' is lacking the varArgs parameters as last Argument");
error = true;
}
if (parameters[parameters.length - 1].getType().getComponentType() != String.class) {
commandSystemWarning(() -> "The method '" + method.toString() + "' is lacking the varArgs parameters of type '" + String.class.getTypeName() + "' as last Argument");
return;
error = true;
}
if (error) return;
commandHelpList.add(new SubCommand<>(this, method, anno.value(), new HashMap<>(), new HashMap<>(), true, null, anno.noTabComplete()));
});