Velocity
Velocity copied to clipboard
Locale not initializing on connect
On my server I use the client's locale to send messages but on the latest velocity version with 1.20.2 the effective locale is null until the player reselects the locale or changes it also the player settings are out of sync and only update when invoking a manual update on the client
What are you using to get the player's locale?
If the PlayerSettingsChangedEvent then see #1117 and #1118.
No, I use the methods Player#getEffectiveLocale() and PlayerSettings#getLocale() but both return Locale#US when connecting
they only update when the player changes the locale (sends a new option packet)
Confirmed bug for me also.
Hi hi guys, I've a problem getting the effective locale of a player in 1.20.2 (probably due to the new config phase)
@Subscribe
public void onServerConnected(ServerConnectedEvent e) {
Player p = e.getPlayer();
RegisteredServer registeredServer = e.getServer();
ZenLibVelocityPlugin.getInstance().logger.info("ServerConnectedEvent: effective Local of "+p.getUsername()+" is "+p.getEffectiveLocale());
ZenLibVelocityPlugin.getInstance().logger.info("ServerConnectedEvent: settings Local of "+p.getUsername()+" is "+p.getPlayerSettings().getLocale());
}
Result for a user in 1.20.1 using french locale:
[21:05:19 INFO] [zenlib]: ServerConnectedEvent: effective Local of Bazhard is fr_FR
[21:05:19 INFO] [zenlib]: ServerConnectedEvent: settings Local of Bazhard is fr_FR
Result for a user in 1.20.2 using same french locale:
[21:02:04 INFO] [zenlib]: ServerConnectedEvent: effective Local of Bazhard is null
[21:02:04 INFO] [zenlib]: ServerConnectedEvent: settings Local of Bazhard is en_US
I also tried with ServerPostConnectEvent and even with a custom command to display locale in tchat. This happen only for 1.20.2 clients. Only way to get the effectiveLocale updated is when the user change settings. But since new config phase update, the PlayerSettingsChangedEvent is not triggered for 1.20.2 on server changes.
Have you tested this after https://github.com/PaperMC/velocity/commit/2e8ef8b2cad0aae6bd9192368c0ae02c542f520e?
And the locale might not have been sent in the ServerConnectedEvent so also look when the PlayerSettingsChangedEvent is triggered.
Hasn't happened to me anymore