mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-19 09:39:12 +00:00
Fix enum MixinEnvironment.Option parsing always using the default (#157)
* Fix enum MixinEnvironment.Option parsing always using the default * Incorporate Chocohead's suggestion
This commit is contained in:
1 parent
da718519e2
commit
da648eae8d
1 file changed
+1
-2
@@ -625,11 +625,10 @@ public final class MixinEnvironment implements ITokenProvider {
|
||||
? System.getProperty(this.property, this.defaultValue) : this.defaultValue;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
<E extends Enum<E>> E getEnumValue(E defaultValue) {
|
||||
String value = System.getProperty(this.property, defaultValue.name());
|
||||
try {
|
||||
return (E)Enum.valueOf(defaultValue.getClass(), value.toUpperCase(Locale.ROOT));
|
||||
return Enum.valueOf(defaultValue.getDeclaringClass(), value.toUpperCase(Locale.ROOT));
|
||||
} catch (IllegalArgumentException ex) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user