Dieser Commit ist enthalten in:
Ursprung
66c50bf6e6
Commit
0d573557b8
@ -332,6 +332,6 @@ public abstract class SWCommand {
|
|||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target({ElementType.PARAMETER})
|
@Target({ElementType.PARAMETER})
|
||||||
protected @interface StaticValue {
|
protected @interface StaticValue {
|
||||||
String value();
|
String[] value() default {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,6 +167,11 @@ public class SWCommandUtils {
|
|||||||
return createMapper((s) -> value.equals(s) ? value : null, s -> Collections.singletonList(value));
|
return createMapper((s) -> value.equals(s) ? value : null, s -> Collections.singletonList(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TypeMapper<String> createMapper(String[] values) {
|
||||||
|
List<String> strings = Arrays.asList(values);
|
||||||
|
return createMapper((s) -> strings.contains(s) ? s : null, s -> strings);
|
||||||
|
}
|
||||||
|
|
||||||
public static <T> TypeMapper<T> createMapper(Function<String, T> mapper, Function<String, List<String>> tabCompleter) {
|
public static <T> TypeMapper<T> createMapper(Function<String, T> mapper, Function<String, List<String>> tabCompleter) {
|
||||||
return createMapper(mapper, (commandSender, s) -> tabCompleter.apply(s));
|
return createMapper(mapper, (commandSender, s) -> tabCompleter.apply(s));
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren