Adds an option for disabling startup fixes

Also fixes configuration default values not being used when the option is missing from the configuration file.
This commit is contained in:
2024-04-21 23:10:26 +02:00
parent 6287a5e492
commit 9db73b7bae
5 changed files with 39 additions and 18 deletions

View File

@@ -418,13 +418,10 @@ public final class StargateConfig {
//Load the option using its correct data type
switch (option.getDataType()) {
case STRING_LIST -> optionValue = newConfig.getStringList(configNode);
case STRING -> {
String value = newConfig.getString(configNode);
optionValue = value != null ? value.trim() : "";
}
case BOOLEAN -> optionValue = newConfig.getBoolean(configNode);
case INTEGER -> optionValue = newConfig.getInt(configNode);
case DOUBLE -> optionValue = newConfig.getDouble(configNode);
case STRING -> optionValue = newConfig.getString(configNode, (String) option.getDefaultValue()).trim();
case BOOLEAN -> optionValue = newConfig.getBoolean(configNode, (boolean) option.getDefaultValue());
case INTEGER -> optionValue = newConfig.getInt(configNode, (int) option.getDefaultValue());
case DOUBLE -> optionValue = newConfig.getDouble(configNode, (double) option.getDefaultValue());
default -> throw new IllegalArgumentException("Invalid config data type encountered");
}
configOptions.put(option, optionValue);