Enables mixed case enums to still be read from yaml config files

https://github.com/BentoBoxWorld/addon-challenges/issues/33
This commit is contained in:
tastybento 2018-12-01 20:36:14 -08:00
parent 76483f7e39
commit e23818f73d

View File

@ -522,7 +522,7 @@ public class YamlDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
// Find out the value
Class<Enum> enumClass = (Class<Enum>)clazz;
try {
value = Enum.valueOf(enumClass, (String)value);
value = Enum.valueOf(enumClass, ((String)value).toUpperCase());
} catch (Exception e) {
// This value does not exist - probably admin typed it wrongly
// Show what is available and pick one at random