[SPIGOT-439] Add PlayerChangeLocaleEvent Created: 18/Jan/15  Updated: 27/May/17  Resolved: 27/May/17

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor
Reporter: MCShamrock Assignee: Unassigned
Resolution: Fixed Votes: 3
Labels: event, spigot


 Description   

There is the ClientSettings packet that a client sends to the server shortly after joining and when the client's settings are changed. This packet includes the client's locale, chat settings, and skin settings. I think it would be quite useful (any very simple to add) to add an event that is fired every time the client sends such a packet, so that plugins can be notified when a client changes its language.

Usage Example:
I am writing a plugin that uses translations and also acts immediately after joining. The problem is that the vanilla client sends the ClientSettings packet on average 5 seconds after joining, which makes it hard to get accurate translations on joining.
Using such an event, my plugin could save the last language for each player, and use the language of the last session of the player even before the player sends the packet some seconds after joining.

Why it is necessary:
One could also create a task that checks each tick for p.spigot().getLocale() changes. But initially all players have the locale en_US. So during this phase the language of the last session could be used. But if the player then decides to really use en_US, the plugin could not detect that and would continue to use the locale of the last session.



 Comments   
Comment by Martin | MiniDigger [ 26/May/17 ]

opened a new pr for this https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests/282

Comment by Zeryther [ 28/Jan/15 ]

I'd also need this for my multi-language server

Comment by MCShamrock [ 21/Jan/15 ]

Added two PRs for this on Bukkit and CraftBukkit.

Comment by MCShamrock [ 20/Jan/15 ]

I'm working on a PR for it...

Generated at Fri Apr 11 14:14:37 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.