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:
parent
6e0f0e4327
commit
b0c03cd484
1 changed files with 9 additions and 0 deletions
|
|
@ -246,6 +246,15 @@ public class Locales {
|
||||||
private static String getPlayerLocale(@NotNull Player player) {
|
private static String getPlayerLocale(@NotNull Player player) {
|
||||||
ParkourUser user = ParkourUser.getUser(player);
|
ParkourUser user = ParkourUser.getUser(player);
|
||||||
String loc = user == null ? Option.OPTIONS_DEFAULTS.get(ParkourOption.LANG) : user.locale;
|
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";
|
return (loc != null && !loc.isBlank()) ? loc : "en";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue