Fix locale bug and parkour spawn position

- Fix locale 'true' bug with sanitization at all levels:
  * ConfigAccessor.getString() - force String.valueOf()
  * Option.java - sanitize LANG defaults from config
  * PlayerSettingsManager - sanitize on settings load
  * SQLDataMapper - sanitize on SQL load
  * StorageDisk - sanitize on JSON load
  * SQLMigrationManager - SQL migration to fix DB

- Fix parkour first block position:
  * Island.java - spawn 6 blocks forward + 1 up from center
  * GeneratorCleanup.java - same position after fall/reset

- Add spawn-location config option at top of config.yml
This commit is contained in:
loki 2026-04-09 13:52:37 +02:00
parent b0c03cd484
commit 3546d7f9e3
10 changed files with 154 additions and 272 deletions

View file

@ -85,11 +85,17 @@ public class ConfigAccessor {
/**
* Get string value at path.
* Forces conversion to String even if YAML parsed as Boolean/Number.
*/
@NotNull
public String getString(@NotNull String path) {
warnIfMissing(path);
return config.getString(path, "");
Object value = config.get(path);
if (value == null) {
return "";
}
// Force toString() to handle Boolean/Number values
return String.valueOf(value);
}
/**

View file

@ -266,6 +266,12 @@ public class Option {
// Always read as String to avoid Boolean parsing issues
String value = Config.CONFIG.getString(defaultPath);
// Sanitize legacy Boolean values for LANG option
if (option == ParkourOption.LANG && ("true".equals(value) || "false".equals(value) || "1".equals(value) || "0".equals(value))) {
value = "en";
LoParkour.getPlugin().getLogger().warning("LANG option had invalid Boolean value, reset to 'en'");
}
// Debug logging
if (option == ParkourOption.LANG) {
LoParkour.getPlugin().getLogger().info("LANG option: path=" + defaultPath + ", value=" + value);