From 4f6bb722ad778b589128f221d3cef8085c95d1c9 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 21 May 2022 16:30:41 +0200 Subject: [PATCH] Fix stuff --- .../listeners/ConnectionListener.java | 8 -------- .../steamwar/bungeecore/sql/SteamwarUser.java | 18 +++++++----------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/ConnectionListener.java b/src/de/steamwar/bungeecore/listeners/ConnectionListener.java index 36940fb..95f6a89 100644 --- a/src/de/steamwar/bungeecore/listeners/ConnectionListener.java +++ b/src/de/steamwar/bungeecore/listeners/ConnectionListener.java @@ -61,14 +61,6 @@ public class ConnectionListener extends BasicListener { ProxiedPlayer player = event.getPlayer(); SteamwarUser user = SteamwarUser.get(player.getUniqueId()); - if (!user.isManualLocale()) { - Locale locale = player.getLocale(); - if (locale == null) { - locale = Locale.getDefault(); - } - user.setLocale(locale, false); - } - player.removeGroups("Admin", "team"); if(user.getUserGroup().isAdminGroup()) diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index 44b93a5..c6e6aec 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -102,10 +102,8 @@ public class SteamwarUser { } String dbLocale = rs.getString("Locale"); - if (dbLocale == null) { - locale = null; - } else { - locale = new Locale(dbLocale); + if (dbLocale != null) { + locale = Locale.forLanguageTag(dbLocale); } manualLocale = rs.getBoolean("ManualLocale"); @@ -383,13 +381,11 @@ public class SteamwarUser { public Locale getLocale() { Locale locale = this.locale; - if (locale == null) { + if (locale == null) locale = BungeeCord.getInstance().getPlayer(uuid).getLocale(); - } - if (locale == null) { - locale = Locale.getDefault(); - } - return locale; + if (locale != null) + return locale; + return Locale.getDefault(); } public boolean isManualLocale() { @@ -402,7 +398,7 @@ public class SteamwarUser { boolean needsUpdate = !this.locale.equals(locale); this.locale = locale; this.manualLocale = manualLocale; - updateLocale.update(locale.getLanguage(), manualLocale, id); + updateLocale.update(locale.toString(), manualLocale, id); if (needsUpdate) new LocaleInvalidationPacket(id).send(getPlayer()); }