Dieser Commit ist enthalten in:
Ursprung
0f03b57e43
Commit
96a5ec6b2f
@ -218,12 +218,12 @@ public class SWCommandUtils {
|
|||||||
public static <T extends AbstractTypeMapper<K, Enum<?>>, K> T createEnumMapper(Class<Enum<?>> enumClass) {
|
public static <T extends AbstractTypeMapper<K, Enum<?>>, K> T createEnumMapper(Class<Enum<?>> enumClass) {
|
||||||
Map<String, Enum<?>> enumMap = new HashMap<>();
|
Map<String, Enum<?>> enumMap = new HashMap<>();
|
||||||
for (Enum<?> e : enumClass.getEnumConstants()) {
|
for (Enum<?> e : enumClass.getEnumConstants()) {
|
||||||
enumMap.put(e.name(), e);
|
enumMap.put(e.name().toLowerCase(), e);
|
||||||
}
|
}
|
||||||
return (T) new AbstractTypeMapper<Object, Enum<?>>() {
|
return (T) new AbstractTypeMapper<Object, Enum<?>>() {
|
||||||
@Override
|
@Override
|
||||||
public Enum<?> map(Object commandSender, String[] previousArguments, String s) {
|
public Enum<?> map(Object commandSender, String[] previousArguments, String s) {
|
||||||
return enumMap.get(s);
|
return enumMap.get(s.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren