mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-12-24 17:47:41 +01:00
Add method to get player's locale
This commit is contained in:
parent
3c938c03c7
commit
91989564e5
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user