From a3ebabacb87754ac0b7e3a8126de2473f4614cc9 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Fri, 18 Jun 2021 15:45:45 +0100 Subject: [PATCH] Fix #3095 --- .../plotsquared/bukkit/listener/PlayerEventListener.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java index f64c52f10..9f3253fa7 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java @@ -339,6 +339,9 @@ public class PlayerEventListener extends PlotListener implements Listener { PlotSquared.platform().playerManager().removePlayer(player.getUniqueId()); final PlotPlayer pp = BukkitUtil.adapt(player); + // we're stripping the country code as we don't want to differ between countries + pp.setLocale(Locale.forLanguageTag(player.getLocale().substring(0, 2))); + Location location = pp.getLocation(); PlotArea area = location.getPlotArea(); if (area != null) { @@ -1677,6 +1680,10 @@ public class PlayerEventListener extends PlotListener implements Listener { @EventHandler public void onLocaleChange(final PlayerLocaleChangeEvent event) { + // The event is fired before the player is deemed online upon login + if (!event.getPlayer().isOnline()) { + return; + } BukkitPlayer player = BukkitUtil.adapt(event.getPlayer()); // we're stripping the country code as we don't want to differ between countries player.setLocale(Locale.forLanguageTag(event.getLocale().substring(0, 2)));