Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locale not initializing on connect #1110

Open
NonSwag opened this issue Oct 13, 2023 · 4 comments
Open

Locale not initializing on connect #1110

NonSwag opened this issue Oct 13, 2023 · 4 comments
Labels
status: awaiting response More information is required

Comments

@NonSwag
Copy link

NonSwag commented Oct 13, 2023

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

@Nacioszeczek
Copy link
Member

What are you using to get the player's locale?
If the PlayerSettingsChangedEvent then see #1117 and #1118.

@NonSwag
Copy link
Author

NonSwag commented Oct 29, 2023

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)

@rayanbzd
Copy link

rayanbzd commented Nov 5, 2023

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.

@Timongcraft
Copy link
Contributor

Have you tested this after 2e8ef8b?
And the locale might not have been sent in the ServerConnectedEvent so also look when the PlayerSettingsChangedEvent is triggered.

@4drian3d 4drian3d added the status: awaiting response More information is required label Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: awaiting response More information is required
Projects
None yet
Development

No branches or pull requests

5 participants