mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 04:55:47 +01:00
48b6bfe2a6
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: c987938a SPIGOT-5180: Add Villager#sleep() and #wakeup() methods CraftBukkit Changes:7f33c6a2
SPIGOT-5196: Restore previous version behaviour regarding cancelled BlockBreakEvent6a5fc902
Improve diff in EntityHangingc98d61bf
SPIGOT-4712: Allow spawning of upwards or downwards facing item framesdb971477
SPIGOT-5199: Fix NPE if setting the book of the ItemMeta of a lecternb0ef3996
SPIGOT-4679 Fix black lines after book paragraphs1215188f
SPIGOT-5180: Add Villager#sleep() and #wakeup() methodsc03b2bef
SPIGOT-4975: NPE on WorldGenStronghold When Using Multiple Worlds65ea162c
Ensure Bukkit data pack is always up to date0b107b8d
MC-157395, SPIGOT-5193: Small armor stands do not drop loot6da0abca
SPIGOT-5195: Player loot table does not drop when keepInventory is on8b09d983
SPIGOT-5190: Superfluous EntityCombustEvent called when using fire aspect sword Spigot Changes: 1981d553 SPIGOT-5198: Catch more bad async operations 6a14ca46 Rebuild patches
71 lines
3.3 KiB
Diff
71 lines
3.3 KiB
Diff
From 9c9d885ced2c7e1e66302b61ebb40c1e5eaa9a05 Mon Sep 17 00:00:00 2001
|
|
From: Isaac Moore <rmsy@me.com>
|
|
Date: Tue, 19 Apr 2016 14:09:31 -0500
|
|
Subject: [PATCH] Implement PlayerLocaleChangeEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
index accf20f03..9dfa92f88 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
@@ -37,7 +37,7 @@ import org.bukkit.inventory.MainHand;
|
|
public class EntityPlayer extends EntityHuman implements ICrafting {
|
|
|
|
private static final Logger LOGGER = LogManager.getLogger();
|
|
- public String locale = "en_us"; // CraftBukkit - lowercase
|
|
+ public String locale = null; // CraftBukkit - lowercase // Paper - default to null
|
|
public PlayerConnection playerConnection;
|
|
public final MinecraftServer server;
|
|
public final PlayerInteractManager playerInteractManager;
|
|
@@ -1449,13 +1449,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(getBukkitEntity(), getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT);
|
|
this.server.server.getPluginManager().callEvent(event);
|
|
}
|
|
- if (!this.locale.equals(packetplayinsettings.b())) {
|
|
+ if (this.locale == null || !this.locale.equals(packetplayinsettings.b())) { // Paper - check for null
|
|
PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(getBukkitEntity(), packetplayinsettings.b());
|
|
this.server.server.getPluginManager().callEvent(event);
|
|
}
|
|
this.clientViewDistance = packetplayinsettings.viewDistance;
|
|
// CraftBukkit end
|
|
+ // Paper start - add PlayerLocaleChangeEvent
|
|
+ // Since the field is initialized to null, this event should always fire the first time the packet is received
|
|
+ String oldLocale = this.locale;
|
|
this.locale = packetplayinsettings.b();
|
|
+ if (!this.locale.equals(oldLocale)) {
|
|
+ new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), oldLocale, this.locale).callEvent();
|
|
+ }
|
|
+ // Paper end
|
|
this.ck = packetplayinsettings.d();
|
|
this.cl = packetplayinsettings.e();
|
|
this.getDataWatcher().set(EntityPlayer.bt, (byte) packetplayinsettings.f());
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
index 881fa70b2..151dcf243 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -1758,8 +1758,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
|
|
@Override
|
|
public String getLocale() {
|
|
- return getHandle().locale;
|
|
-
|
|
+ // Paper start - Locale change event
|
|
+ final String locale = getHandle().locale;
|
|
+ return locale != null ? locale : "en_us";
|
|
+ // Paper end
|
|
}
|
|
|
|
// Paper start
|
|
@@ -1849,7 +1851,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
@Override
|
|
public String getLocale()
|
|
{
|
|
- return getHandle().locale;
|
|
+ return CraftPlayer.this.getLocale(); // Paper
|
|
}
|
|
|
|
@Override
|
|
--
|
|
2.22.0
|
|
|