SteamWar/BungeeCore
Archiviert
13
2

Fix settings changed npe
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2022-06-07 14:13:51 +02:00
Ursprung 9f7f5eef36
Commit c74b2b2c84
2 geänderte Dateien mit 2 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -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.api.event.SettingsChangedEvent;
import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.event.EventHandler;
import java.util.Objects;
public class SettingsChangedListener extends BasicListener { public class SettingsChangedListener extends BasicListener {
@EventHandler @EventHandler
public void onSettingsChanged(SettingsChangedEvent event) { public void onSettingsChanged(SettingsChangedEvent event) {
BungeeCord.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> { BungeeCord.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> {
ProxiedPlayer player = event.getPlayer(); ProxiedPlayer player = event.getPlayer();
SteamwarUser.get(player).setLocale(Objects.requireNonNull(player.getLocale()), false); SteamwarUser.get(player).setLocale(player.getLocale(), false);
}); });
} }
} }

Datei anzeigen

@ -382,7 +382,7 @@ public class SteamwarUser {
} }
public void setLocale(Locale locale, boolean manualLocale) { public void setLocale(Locale locale, boolean manualLocale) {
if (this.manualLocale && !manualLocale) if (locale == null || (this.manualLocale && !manualLocale))
return; return;
this.locale = locale; this.locale = locale;