mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-12-28 17:38:01 +01:00
Change player locale on event
This commit is contained in:
parent
9b086b3f2a
commit
72507aba4b
@ -126,6 +126,7 @@ import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
|||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerLocaleChangeEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
@ -148,6 +149,7 @@ import java.lang.reflect.Field;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@ -1624,4 +1626,10 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler public void onLocaleChange(final PlayerLocaleChangeEvent event) {
|
||||||
|
BukkitPlayer player = BukkitUtil.adapt(event.getPlayer());
|
||||||
|
// we're stripping the country code as we con't want to differ between countries
|
||||||
|
player.setLocale(Locale.forLanguageTag(event.getLocale().substring(0, 2)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user