Add better int and long handling for StaticValue annotation
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-08-16 17:53:59 +02:00
Ursprung 23a72f2acf
Commit 696c03b851

Datei anzeigen

@ -145,18 +145,11 @@ public class SWCommandUtils {
return index == -1 ? null : !falseValues.contains(index);
}, (commandSender, s) -> tabCompletes);
}
if ((parameter.getType() == int.class || parameter.getType() == Integer.class) && staticValue.value().length >= 2) {
if ((parameter.getType() == int.class || parameter.getType() == Integer.class || parameter.getType() == long.class || parameter.getType() == Long.class) && staticValue.value().length >= 2) {
List<String> tabCompletes = new ArrayList<>(Arrays.asList(staticValue.value()));
return createMapper(s -> {
int index = tabCompletes.indexOf(s);
return index == -1 ? null : index;
}, (commandSender, s) -> tabCompletes);
}
if ((parameter.getType() == long.class || parameter.getType() == Long.class) && staticValue.value().length >= 2) {
List<String> tabCompletes = new ArrayList<>(Arrays.asList(staticValue.value()));
return createMapper(s -> {
long index = tabCompletes.indexOf(s);
return index == -1 ? null : index;
Number index = tabCompletes.indexOf(s);
return index.longValue() == -1 ? null : index;
}, (commandSender, s) -> tabCompletes);
}
}