Fix enum mapper
Dieser Commit ist enthalten in:
Ursprung
6d29507973
Commit
f619797824
@ -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