Always specify Locale on toLowerCase and toUpperCase usages, fixes AuthMe not working correctly on machines with turkish locale. ('I'.toLowerCase() => 'ı')

This commit is contained in:
Gabriele C
2022-08-20 04:41:04 +02:00
parent c38e2aba28
commit 75b3a571e1
67 changed files with 217 additions and 143 deletions
@@ -14,6 +14,7 @@ import org.bukkit.Location;
import org.bukkit.entity.Player;
import javax.inject.Inject;
import java.util.Locale;
/**
* Saves all players' data when the plugin shuts down.
@@ -48,7 +49,7 @@ public class OnShutdownPlayerSaver {
}
private void savePlayer(Player player) {
String name = player.getName().toLowerCase();
String name = player.getName().toLowerCase(Locale.ROOT);
if (PlayerUtils.isNpc(player) || validationService.isUnrestricted(name)) {
return;
}
@@ -64,7 +65,7 @@ public class OnShutdownPlayerSaver {
if (settings.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) {
Location loc = spawnLoader.getPlayerLocationOrSpawn(player);
PlayerAuth auth = PlayerAuth.builder()
.name(player.getName().toLowerCase())
.name(player.getName().toLowerCase(Locale.ROOT))
.realName(player.getName())
.location(loc).build();
dataSource.updateQuitLoc(auth);