From 9233a7fb05733626fac85e44999177dc6d0f59ec Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 26 Jun 2020 08:06:30 +1000 Subject: [PATCH] SPIGOT-5827: Player.getLocale always returns en_us --- nms-patches/EntityPlayer.patch | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/nms-patches/EntityPlayer.patch b/nms-patches/EntityPlayer.patch index 98a52d3c94..e75575647c 100644 --- a/nms-patches/EntityPlayer.patch +++ b/nms-patches/EntityPlayer.patch @@ -157,13 +157,13 @@ Logger logger = EntityPlayer.LOGGER; logger.getClass(); -@@ -199,8 +303,32 @@ +@@ -199,9 +303,33 @@ nbttagcompound.set("SpawnDimension", nbtbase); }); } + this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit -+ -+ } + + } + // CraftBukkit start - World fallback code, either respawn location or global spawn + public void spawnIn(World world) { @@ -185,11 +185,12 @@ + this.setPosition(position.getX(), position.getY(), position.getZ()); + } + this.playerInteractManager.a((WorldServer) world); - } ++ } + // CraftBukkit end - ++ public void a(int i) { float f = (float) this.getExpToLevel(); + float f1 = (f - 1.0F) / f; @@ -255,6 +383,11 @@ @Override @@ -760,7 +761,7 @@ this.playerInteractManager.setGameMode(enumgamemode); this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.d, (float) enumgamemode.getId())); if (enumgamemode == EnumGamemode.SPECTATOR) { -@@ -1184,7 +1555,19 @@ +@@ -1184,7 +1555,20 @@ return s; } @@ -775,12 +776,13 @@ + PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(getBukkitEntity(), packetplayinsettings.locale); + this.server.server.getPluginManager().callEvent(event); + } ++ this.locale = packetplayinsettings.locale; + this.clientViewDistance = packetplayinsettings.viewDistance; + // CraftBukkit end this.cf = packetplayinsettings.d(); this.cg = packetplayinsettings.e(); this.getDataWatcher().set(EntityPlayer.bp, (byte) packetplayinsettings.f()); -@@ -1220,13 +1603,13 @@ +@@ -1220,13 +1604,13 @@ if (entity instanceof EntityHuman) { this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[]{entity.getId()})); } else { @@ -796,7 +798,7 @@ } @Override -@@ -1250,7 +1633,7 @@ +@@ -1250,7 +1634,7 @@ this.spectatedEntity = (Entity) (entity == null ? this : entity); if (entity1 != this.spectatedEntity) { this.playerConnection.sendPacket(new PacketPlayOutCamera(this.spectatedEntity)); @@ -805,7 +807,7 @@ } } -@@ -1279,7 +1662,7 @@ +@@ -1279,7 +1663,7 @@ @Nullable public IChatBaseComponent getPlayerListName() { @@ -814,7 +816,7 @@ } @Override -@@ -1300,9 +1683,16 @@ +@@ -1300,9 +1684,16 @@ return this.advancementDataPlayer; } @@ -831,7 +833,7 @@ if (worldserver == this.world) { this.playerConnection.a(d0, d1, d2, f, f1); } else { -@@ -1323,6 +1713,9 @@ +@@ -1323,6 +1714,9 @@ this.server.getPlayerList().a(this, worldserver); this.server.getPlayerList().updateClient(this); } @@ -841,7 +843,7 @@ } -@@ -1409,4 +1802,144 @@ +@@ -1409,4 +1803,144 @@ return entityitem; } }