mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Allow enum fields to be set through standalone command line
This commit is contained in:
parent
b95cd8e0c1
commit
e20247b6d6
1 changed files with 3 additions and 0 deletions
|
@ -315,6 +315,7 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap {
|
||||||
* @param parentObject The object to alter
|
* @param parentObject The object to alter
|
||||||
* @param value The new value of the property
|
* @param value The new value of the property
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked") // Required for enum usage
|
||||||
private static void setConfigOption(BeanPropertyDefinition property, Object parentObject, Object value) {
|
private static void setConfigOption(BeanPropertyDefinition property, Object parentObject, Object value) {
|
||||||
Object parsedValue = value;
|
Object parsedValue = value;
|
||||||
|
|
||||||
|
@ -323,6 +324,8 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap {
|
||||||
parsedValue = Integer.valueOf((String) parsedValue);
|
parsedValue = Integer.valueOf((String) parsedValue);
|
||||||
} else if (boolean.class.equals(property.getRawPrimaryType())) {
|
} else if (boolean.class.equals(property.getRawPrimaryType())) {
|
||||||
parsedValue = Boolean.valueOf((String) parsedValue);
|
parsedValue = Boolean.valueOf((String) parsedValue);
|
||||||
|
} else if (Enum.class.isAssignableFrom(property.getRawPrimaryType())) {
|
||||||
|
parsedValue = Enum.valueOf((Class<? extends Enum>) property.getRawPrimaryType(), ((String) parsedValue).toUpperCase(Locale.ROOT));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force the value to be set
|
// Force the value to be set
|
||||||
|
|
Loading…
Reference in a new issue