aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0017-Add-PlayerLocaleChangeEvent.patch
blob: 1dd60842789252885a7c07feb75d1f791a7d3b7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Isaac Moore <rmsy@me.com>
Date: Mon, 29 Feb 2016 18:02:25 -0600
Subject: [PATCH] Add PlayerLocaleChangeEvent


diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..bb7baa91fd4ba763fd8ce216bc9043c5e2c4b7b7
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java
@@ -0,0 +1,51 @@
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.jetbrains.annotations.ApiStatus;
+
+/**
+ * Called when the locale of the player is changed.
+ *
+ * @deprecated Replaced by {@link org.bukkit.event.player.PlayerLocaleChangeEvent} upstream
+ */
+@Deprecated(forRemoval = true) @ApiStatus.ScheduledForRemoval(inVersion = "1.21")
+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;
+    }
+}