summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiniDigger <admin@minidigger.me>2017-05-26 23:31:07 +0200
committermd_5 <git@md-5.net>2017-05-27 19:03:18 +1000
commit1f3b0516a644fe37fdee0626f137dd65d4fcd88d (patch)
tree23a02a5b7854e4e1f3b153d0d78821afe91ce6e4 /src
parentcc40de87027fc6668aa054dec8e8ac257aecf9d9 (diff)
downloadbukkit-1f3b0516a644fe37fdee0626f137dd65d4fcd88d.tar
bukkit-1f3b0516a644fe37fdee0626f137dd65d4fcd88d.tar.gz
bukkit-1f3b0516a644fe37fdee0626f137dd65d4fcd88d.tar.lz
bukkit-1f3b0516a644fe37fdee0626f137dd65d4fcd88d.tar.xz
bukkit-1f3b0516a644fe37fdee0626f137dd65d4fcd88d.zip
SPIGOT-439: Add player locale related APIs.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/entity/Player.java13
-rw-r--r--src/main/java/org/bukkit/event/player/PlayerLocaleChangeEvent.java37
2 files changed, 50 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 92604ab3..33f6e6dc 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -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();
}
diff --git a/src/main/java/org/bukkit/event/player/PlayerLocaleChangeEvent.java b/src/main/java/org/bukkit/event/player/PlayerLocaleChangeEvent.java
new file mode 100644
index 00000000..fbbfcccc
--- /dev/null
+++ b/src/main/java/org/bukkit/event/player/PlayerLocaleChangeEvent.java
@@ -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;
+ }
+}