Add migration fix for legacy Boolean locale values

Players with saved locale="true" from old config parsing
now get auto-migrated to default locale on next login.
This commit is contained in:
loki 2026-04-09 13:06:12 +02:00
parent 6e0f0e4327
commit b0c03cd484

View file

@ -246,6 +246,15 @@ public class Locales {
private static String getPlayerLocale(@NotNull Player player) {
ParkourUser user = ParkourUser.getUser(player);
String loc = user == null ? Option.OPTIONS_DEFAULTS.get(ParkourOption.LANG) : user.locale;
// Fix legacy Boolean "true" values from old config parsing
if ("true".equals(loc) || "false".equals(loc)) {
loc = Option.OPTIONS_DEFAULTS.get(ParkourOption.LANG);
if (user != null) {
user.locale = loc; // Update user's locale to fixed value
}
}
return (loc != null && !loc.isBlank()) ? loc : "en";
}
}