SteamWar/SpigotCore
Archiviert
13
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) { private static Function<String, List<String>> numberCompleter(Function<String, ?> mapper) {
return s -> { return s -> numberMapper(mapper).apply(s) != null
try { ? Collections.singletonList(s)
mapper.apply(s); : Collections.emptyList();
return Collections.singletonList(s);
} catch (Exception e) {
return Collections.emptyList();
}
};
} }
static <T extends Annotation> T[] getAnnotation(Method method, Class<T> annotation) { static <T extends Annotation> T[] getAnnotation(Method method, Class<T> annotation) {

Datei anzeigen

@ -40,7 +40,7 @@ class SubCommand {
private Function<CommandSender, ?> commandSenderFunction; private Function<CommandSender, ?> commandSenderFunction;
Class<?> varArgType = null; 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.swCommand = swCommand;
this.method = method; this.method = method;