3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 19:10:09 +01:00
Paper/Spigot-API-Patches/0010-Add-PlayerLocaleChangeEvent.patch
2015-04-27 21:44:11 -05:00

63 Zeilen
1.6 KiB
Diff

From eb89a2994624f064ca2508434247629e746a8dd4 Mon Sep 17 00:00:00 2001
From: Isaac Moore <rmsy@me.com>
Date: Mon, 27 Apr 2015 21:41:39 -0500
Subject: [PATCH] Add PlayerLocaleChangeEvent
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 0000000..3efd159
--- /dev/null
+++ b/src/main/java/org/bukkit/event/player/PlayerLocaleChangeEvent.java
@@ -0,0 +1,46 @@
+package org.bukkit.event.player;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+
+/**
+ * Called when the locale of the player is changed.
+ */
+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;
+ }
+}
\ No newline at end of file
--
1.9.1