mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 06:25:15 +01:00
Fix wrong assumption about locale being null in the login phase (#11204)
Fixes #11203
This commit is contained in:
parent
5a5c3a4a24
commit
7e44684a1f
1 changed files with 5 additions and 4 deletions
|
@ -2584,10 +2584,10 @@ index c5ba5e30cd74ca2cfc3f952c7b992df239a53a34..fdb75db02603ef97b624219211a0db22
|
|||
@Override
|
||||
public PacketType<ClientboundSystemChatPacket> type() {
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/login/ClientboundLoginDisconnectPacket.java b/src/main/java/net/minecraft/network/protocol/login/ClientboundLoginDisconnectPacket.java
|
||||
index bb97fdb9aa6167083442a928276ebe4225a586ef..5d1758086ed4fce5b36a5b31df44ccea42abc590 100644
|
||||
index bb97fdb9aa6167083442a928276ebe4225a586ef..eeaa40e8121643c6c1d951e76e7361e29210ba48 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/login/ClientboundLoginDisconnectPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/login/ClientboundLoginDisconnectPacket.java
|
||||
@@ -18,11 +18,15 @@ public class ClientboundLoginDisconnectPacket implements Packet<ClientLoginPacke
|
||||
@@ -18,11 +18,16 @@ public class ClientboundLoginDisconnectPacket implements Packet<ClientLoginPacke
|
||||
}
|
||||
|
||||
private ClientboundLoginDisconnectPacket(FriendlyByteBuf buf) {
|
||||
|
@ -2599,8 +2599,9 @@ index bb97fdb9aa6167083442a928276ebe4225a586ef..5d1758086ed4fce5b36a5b31df44ccea
|
|||
- buf.writeUtf(Component.Serializer.toJson(this.reason, RegistryAccess.EMPTY));
|
||||
+ // Paper start - Adventure
|
||||
+ // buf.writeUtf(Component.Serializer.toJson(this.reason, RegistryAccess.EMPTY));
|
||||
+ // In the login phase, buf.adventure$locale field is always null
|
||||
+ buf.writeJsonWithCodec(net.minecraft.network.chat.ComponentSerialization.localizedCodec(java.util.Locale.US), this.reason, FriendlyByteBuf.MAX_COMPONENT_STRING_LENGTH);
|
||||
+ // In the login phase, buf.adventure$locale field is most likely null, but plugins may use internals to set it via the channel attribute
|
||||
+ java.util.Locale bufLocale = buf.adventure$locale;
|
||||
+ buf.writeJsonWithCodec(net.minecraft.network.chat.ComponentSerialization.localizedCodec(bufLocale == null ? java.util.Locale.US : bufLocale), this.reason, FriendlyByteBuf.MAX_COMPONENT_STRING_LENGTH);
|
||||
+ // Paper end - Adventure
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue