mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 09:17:36 +01:00
SPIGOT-439: Add player locale related APIs.
By: MiniDigger <admin@minidigger.me>
This commit is contained in:
parent
d42ac41060
commit
6e76dbda88
@ -1403,4 +1403,17 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
|
||||
* @return object detailing the player's progress
|
||||
*/
|
||||
public AdvancementProgress getAdvancementProgress(Advancement advancement);
|
||||
|
||||
/**
|
||||
* Gets the player's current locale.
|
||||
*
|
||||
* The value of the locale String is not defined properly.
|
||||
* <br>
|
||||
* The vanilla Minecraft client will use lowercase language / country pairs
|
||||
* separated by an underscore, but custom resource packs may use any format
|
||||
* they wish.
|
||||
*
|
||||
* @return the player's locale
|
||||
*/
|
||||
public String getLocale();
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a player changes their locale in the client settings.
|
||||
*/
|
||||
public class PlayerLocaleChangeEvent extends PlayerEvent {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
//
|
||||
private final String locale;
|
||||
|
||||
public PlayerLocaleChangeEvent(Player who, String locale) {
|
||||
super(who);
|
||||
this.locale = locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Player#getLocale()
|
||||
*
|
||||
* @return the player's new locale
|
||||
*/
|
||||
public String getLocale() {
|
||||
return locale;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user