SPIGOT-5827: Player.getLocale always returns en_us

This commit is contained in:
md_5 2020-06-26 08:06:30 +10:00
parent 72c080cca6
commit 9233a7fb05
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -157,13 +157,13 @@
Logger logger = EntityPlayer.LOGGER; Logger logger = EntityPlayer.LOGGER;
logger.getClass(); logger.getClass();
@@ -199,8 +303,32 @@ @@ -199,9 +303,33 @@
nbttagcompound.set("SpawnDimension", nbtbase); nbttagcompound.set("SpawnDimension", nbtbase);
}); });
} }
+ this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit + this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit
+
+ } }
+ // CraftBukkit start - World fallback code, either respawn location or global spawn + // CraftBukkit start - World fallback code, either respawn location or global spawn
+ public void spawnIn(World world) { + public void spawnIn(World world) {
@ -185,11 +185,12 @@
+ this.setPosition(position.getX(), position.getY(), position.getZ()); + this.setPosition(position.getX(), position.getY(), position.getZ());
+ } + }
+ this.playerInteractManager.a((WorldServer) world); + this.playerInteractManager.a((WorldServer) world);
} + }
+ // CraftBukkit end + // CraftBukkit end
+
public void a(int i) { public void a(int i) {
float f = (float) this.getExpToLevel(); float f = (float) this.getExpToLevel();
float f1 = (f - 1.0F) / f;
@@ -255,6 +383,11 @@ @@ -255,6 +383,11 @@
@Override @Override
@ -760,7 +761,7 @@
this.playerInteractManager.setGameMode(enumgamemode); this.playerInteractManager.setGameMode(enumgamemode);
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.d, (float) enumgamemode.getId())); this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.d, (float) enumgamemode.getId()));
if (enumgamemode == EnumGamemode.SPECTATOR) { if (enumgamemode == EnumGamemode.SPECTATOR) {
@@ -1184,7 +1555,19 @@ @@ -1184,7 +1555,20 @@
return s; return s;
} }
@ -775,12 +776,13 @@
+ PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(getBukkitEntity(), packetplayinsettings.locale); + PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(getBukkitEntity(), packetplayinsettings.locale);
+ this.server.server.getPluginManager().callEvent(event); + this.server.server.getPluginManager().callEvent(event);
+ } + }
+ this.locale = packetplayinsettings.locale;
+ this.clientViewDistance = packetplayinsettings.viewDistance; + this.clientViewDistance = packetplayinsettings.viewDistance;
+ // CraftBukkit end + // CraftBukkit end
this.cf = packetplayinsettings.d(); this.cf = packetplayinsettings.d();
this.cg = packetplayinsettings.e(); this.cg = packetplayinsettings.e();
this.getDataWatcher().set(EntityPlayer.bp, (byte) packetplayinsettings.f()); this.getDataWatcher().set(EntityPlayer.bp, (byte) packetplayinsettings.f());
@@ -1220,13 +1603,13 @@ @@ -1220,13 +1604,13 @@
if (entity instanceof EntityHuman) { if (entity instanceof EntityHuman) {
this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[]{entity.getId()})); this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[]{entity.getId()}));
} else { } else {
@ -796,7 +798,7 @@
} }
@Override @Override
@@ -1250,7 +1633,7 @@ @@ -1250,7 +1634,7 @@
this.spectatedEntity = (Entity) (entity == null ? this : entity); this.spectatedEntity = (Entity) (entity == null ? this : entity);
if (entity1 != this.spectatedEntity) { if (entity1 != this.spectatedEntity) {
this.playerConnection.sendPacket(new PacketPlayOutCamera(this.spectatedEntity)); this.playerConnection.sendPacket(new PacketPlayOutCamera(this.spectatedEntity));
@ -805,7 +807,7 @@
} }
} }
@@ -1279,7 +1662,7 @@ @@ -1279,7 +1663,7 @@
@Nullable @Nullable
public IChatBaseComponent getPlayerListName() { public IChatBaseComponent getPlayerListName() {
@ -814,7 +816,7 @@
} }
@Override @Override
@@ -1300,9 +1683,16 @@ @@ -1300,9 +1684,16 @@
return this.advancementDataPlayer; return this.advancementDataPlayer;
} }
@ -831,7 +833,7 @@
if (worldserver == this.world) { if (worldserver == this.world) {
this.playerConnection.a(d0, d1, d2, f, f1); this.playerConnection.a(d0, d1, d2, f, f1);
} else { } else {
@@ -1323,6 +1713,9 @@ @@ -1323,6 +1714,9 @@
this.server.getPlayerList().a(this, worldserver); this.server.getPlayerList().a(this, worldserver);
this.server.getPlayerList().updateClient(this); this.server.getPlayerList().updateClient(this);
} }
@ -841,7 +843,7 @@
} }
@@ -1409,4 +1802,144 @@ @@ -1409,4 +1803,144 @@
return entityitem; return entityitem;
} }
} }