diff --git a/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java b/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java index 20881df1..423ece5d 100644 --- a/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java +++ b/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java @@ -1,5 +1,6 @@ package net.md_5.bungee.api.connection; +import java.util.Locale; import net.md_5.bungee.api.Callback; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.config.ServerInfo; @@ -133,4 +134,11 @@ public interface ProxiedPlayer extends Connection, CommandSender * @return the UUID */ UUID getUniqueId(); + + /** + * Gets this player's locale. + * + * @return the locale + */ + Locale getLocale(); } diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java index 20518d37..5b06bf88 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -13,6 +13,7 @@ import java.net.InetSocketAddress; import java.util.Collection; import java.util.Collections; import java.util.HashSet; +import java.util.Locale; import java.util.Objects; import java.util.UUID; import java.util.logging.Level; @@ -105,6 +106,7 @@ public final class UserConnection implements ProxiedPlayer private String displayName; @Getter private EntityMap entityRewrite; + private Locale locale; /*========================================================================*/ private final Unsafe unsafe = new Unsafe() { @@ -429,4 +431,10 @@ public final class UserConnection implements ProxiedPlayer { return getPendingConnection().getUniqueId(); } + + @Override + public Locale getLocale() + { + return ( locale == null ) ? locale = Locale.forLanguageTag( settings.getLocale() ) : locale; + } }