-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Set player locale when creating Audience #160
Conversation
So it is running fine on 1.12 up to 1.20.4, can't tell about 1.20.5 yet. |
Why do i feel like on 1.8 |
Any chance you'd be able to revise this PR to include that variant? I'd love to spin off a -platform release soon including this PR. |
At least, the following code did not work, it still returns private static final MethodHandle SPIGOT_SUPPORTED = findMethod(Player.class, "spigot", findClass("org.bukkit.entity.Player.Spigot"));
private static final MethodHandle SPIGOT_LOCALE_SUPPORTED = findMethod(findClass("org.bukkit.entity.Player.Spigot"), "getLocale", String.class);
//...
builder.withDynamic(Identity.LOCALE, () -> {
if (LOCALE_SUPPORTED != null) {
try {
return Translator.parseLocale((String) LOCALE_SUPPORTED.invoke(viewer));
} catch (final Throwable error) {
logError(error, "Failed to call getLocale() for %s", viewer);
}
}
if (SPIGOT_SUPPORTED != null && SPIGOT_LOCALE_SUPPORTED != null) {
try {
final String localeStr = (String) SPIGOT_LOCALE_SUPPORTED.invoke(SPIGOT_SUPPORTED.invoke(viewer));
return Translator.parseLocale(localeStr);
} catch (final Throwable error) {
logError(error, "Failed to call spigot().getLocale() for %s", viewer);
}
}
return Locale.getDefault();
}); |
You know, if 1.8 is fixable then let's just let the 1.8 people PR that fix and get this release out already, otherwise the PR looks fine |
The pull request sets the client locale for Player audiences in the adventure-platform-bukkit module.
Until now, the client locale was only correct if the player changed their locale via settings while playing on the server.