mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 17:07:34 +01:00
73 lines
2.2 KiB
Diff
73 lines
2.2 KiB
Diff
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..57f6c47e4e759abf0af9aa8962551225cc12246c
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java
|
|
@@ -0,0 +1,60 @@
|
|
+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;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+import org.jetbrains.annotations.Nullable;
|
|
+
|
|
+/**
|
|
+ * 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 HANDLER_LIST = new HandlerList();
|
|
+
|
|
+ private final String oldLocale;
|
|
+ private final String newLocale;
|
|
+
|
|
+ @ApiStatus.Internal
|
|
+ public PlayerLocaleChangeEvent(final @NotNull Player player, final @Nullable String oldLocale, final @NotNull String newLocale) {
|
|
+ super(player);
|
|
+ this.oldLocale = oldLocale;
|
|
+ this.newLocale = newLocale;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Gets the locale the player switched from.
|
|
+ *
|
|
+ * @return player's old locale
|
|
+ */
|
|
+ @Nullable
|
|
+ public String getOldLocale() {
|
|
+ return this.oldLocale;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Gets the locale the player is changed to.
|
|
+ *
|
|
+ * @return player's new locale
|
|
+ */
|
|
+ @NotNull
|
|
+ public String getNewLocale() {
|
|
+ return this.newLocale;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ @NotNull
|
|
+ public HandlerList getHandlers() {
|
|
+ return HANDLER_LIST;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public static HandlerList getHandlerList() {
|
|
+ return HANDLER_LIST;
|
|
+ }
|
|
+}
|