12
0

Optimize SWCommandUtils.numberCompleter

Dieser Commit ist enthalten in:
yoyosource 2021-05-05 10:11:02 +02:00
Ursprung 37d308346e
Commit 218641b21d
2 geänderte Dateien mit 4 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -182,14 +182,9 @@ public class SWCommandUtils {
}
private static Function<String, List<String>> numberCompleter(Function<String, ?> mapper) {
return s -> {
try {
mapper.apply(s);
return Collections.singletonList(s);
} catch (Exception e) {
return Collections.emptyList();
}
};
return s -> numberMapper(mapper).apply(s) != null
? Collections.singletonList(s)
: Collections.emptyList();
}
static <T extends Annotation> T[] getAnnotation(Method method, Class<T> annotation) {

Datei anzeigen

@ -40,7 +40,7 @@ class SubCommand {
private Function<CommandSender, ?> commandSenderFunction;
Class<?> varArgType = null;
public SubCommand(SWCommand swCommand, Method method, String[] subCommand, Map<String, TypeMapper<?>> localTypeMapper) {
SubCommand(SWCommand swCommand, Method method, String[] subCommand, Map<String, TypeMapper<?>> localTypeMapper) {
this.swCommand = swCommand;
this.method = method;