Optimize SWCommandUtils.numberCompleter
Dieser Commit ist enthalten in:
Ursprung
37d308346e
Commit
218641b21d
@ -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) {
|
||||
|
@ -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;
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren