This repository has been archived by the owner on Aug 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
126 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
From 229ebfcfd563a023c7a1a7b08cdfe628d759cd79 Mon Sep 17 00:00:00 2001 | ||
From: Isaac Moore <rmsy@me.com> | ||
Date: Tue, 2 Sep 2014 20:35:37 -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..5e5452e | ||
--- /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; | ||
+ } | ||
+} | ||
-- | ||
1.8.4.msysgit.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
From f4b712f272face0c1ff9820782492b5cd56e0194 Mon Sep 17 00:00:00 2001 | ||
From: Isaac Moore <rmsy@me.com> | ||
Date: Tue, 2 Sep 2014 20:36:42 -0500 | ||
Subject: [PATCH] Add PlayerLocaleChangeEvent | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java | ||
index b312ec9..d29ecef 100644 | ||
--- a/src/main/java/net/minecraft/server/EntityPlayer.java | ||
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java | ||
@@ -999,7 +999,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting { | ||
} | ||
|
||
public void a(PacketPlayInSettings packetplayinsettings) { | ||
+ // SportBukkit start - add PlayerLocaleChangeEvent | ||
+ String oldLocale = this.locale; | ||
this.locale = packetplayinsettings.c(); | ||
+ if (!this.locale.equals(oldLocale)) { | ||
+ CraftEventFactory.callPlayerLocaleChangeEvent(this, oldLocale, this.locale); | ||
+ } | ||
+ // SportBukkit end | ||
int i = 256 >> packetplayinsettings.d(); | ||
|
||
if (i > 3 && i < 20) { | ||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java | ||
index 4478e08..0743c25 100644 | ||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java | ||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java | ||
@@ -912,4 +912,11 @@ public class CraftEventFactory { | ||
entityHuman.world.getServer().getPluginManager().callEvent(event); | ||
return (Cancellable) event; | ||
} | ||
+ | ||
+ public static PlayerLocaleChangeEvent callPlayerLocaleChangeEvent(EntityHuman who, String oldLocale, String newLocale) { | ||
+ Player player = (Player) who.getBukkitEntity(); | ||
+ PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(player, oldLocale, newLocale); | ||
+ Bukkit.getPluginManager().callEvent(event); | ||
+ return event; | ||
+ } | ||
} | ||
-- | ||
1.8.4.msysgit.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters