Paper/Spigot-API-Patches/0009-Add-PlayerLocaleChangeEvent.patch

66 lines
1.8 KiB
Diff
Raw Normal View History

2019-04-23 06:47:07 +02:00
From 9a6838df086b3cfe02bc73770d02dffc80458b6e Mon Sep 17 00:00:00 2001
2016-03-03 10:46:26 +01:00
From: Isaac Moore <rmsy@me.com>
2016-03-01 00:09:49 +01:00
Date: Mon, 29 Feb 2016 18:02:25 -0600
2015-04-28 04:43:59 +02:00
Subject: [PATCH] Add PlayerLocaleChangeEvent
2016-03-01 00:09:49 +01:00
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java
2015-04-28 04:43:59 +02:00
new file mode 100644
2017-05-28 06:25:17 +02:00
index 00000000..29dd763a
2015-04-28 04:43:59 +02:00
--- /dev/null
2016-03-01 00:09:49 +01:00
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java
2017-05-28 06:25:17 +02:00
@@ -0,0 +1,50 @@
2016-03-01 00:09:49 +01:00
+package com.destroystokyo.paper.event.player;
2015-04-28 04:43:59 +02:00
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
2016-03-01 00:09:49 +01:00
+import org.bukkit.event.player.PlayerEvent;
2015-04-28 04:43:59 +02:00
+
+/**
+ * Called when the locale of the player is changed.
2017-05-28 06:25:17 +02:00
+ *
+ * @deprecated Replaced by {@link org.bukkit.event.player.PlayerLocaleChangeEvent} upstream
2015-04-28 04:43:59 +02:00
+ */
2017-05-28 06:25:17 +02:00
+@Deprecated
2015-04-28 04:43:59 +02:00
+public class PlayerLocaleChangeEvent extends PlayerEvent {
+ private static final HandlerList handlers = new HandlerList();
+ private final String oldLocale;
+ private final String newLocale;
+
+ public PlayerLocaleChangeEvent(final Player player, final String oldLocale, final String newLocale) {
+ super(player);
+ this.oldLocale = oldLocale;
+ this.newLocale = newLocale;
+ }
+
+ /**
+ * Gets the locale the player switched from.
+ *
+ * @return player's old locale
+ */
+ public String getOldLocale() {
+ return oldLocale;
+ }
+
+ /**
+ * Gets the locale the player is changed to.
+ *
+ * @return player's new locale
+ */
+ public String getNewLocale() {
+ return newLocale;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2019-04-23 06:47:07 +02:00
2.21.0
2015-04-28 04:43:59 +02:00