From c74b2b2c84f45613c953aca52541613534d3979d Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 7 Jun 2022 14:13:51 +0200 Subject: [PATCH] Fix settings changed npe Signed-off-by: Lixfel --- .../bungeecore/listeners/SettingsChangedListener.java | 4 +--- src/de/steamwar/bungeecore/sql/SteamwarUser.java | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/SettingsChangedListener.java b/src/de/steamwar/bungeecore/listeners/SettingsChangedListener.java index 3858a69..5affb64 100644 --- a/src/de/steamwar/bungeecore/listeners/SettingsChangedListener.java +++ b/src/de/steamwar/bungeecore/listeners/SettingsChangedListener.java @@ -26,15 +26,13 @@ import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.SettingsChangedEvent; import net.md_5.bungee.event.EventHandler; -import java.util.Objects; - public class SettingsChangedListener extends BasicListener { @EventHandler public void onSettingsChanged(SettingsChangedEvent event) { BungeeCord.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> { ProxiedPlayer player = event.getPlayer(); - SteamwarUser.get(player).setLocale(Objects.requireNonNull(player.getLocale()), false); + SteamwarUser.get(player).setLocale(player.getLocale(), false); }); } } diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index 901c219..829ee84 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -382,7 +382,7 @@ public class SteamwarUser { } public void setLocale(Locale locale, boolean manualLocale) { - if (this.manualLocale && !manualLocale) + if (locale == null || (this.manualLocale && !manualLocale)) return; this.locale = locale;