Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2025-01-12 08:01:06 +01:00
Allow enum fields to be set through standalone command line
Dieser Commit ist enthalten in:
Ursprung
b95cd8e0c1
Commit
e20247b6d6
@ -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
|
||||||
|
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren