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) {
|
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) {
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren