mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-14 05:33:56 +01:00
Fix wrong assumption about locale being null in the login phase (#11204)
Fixes #11203
This commit is contained in:
parent
36c41877b6
commit
f8f2bd7db7
1 changed files with 3 additions and 2 deletions
|
@ -2599,8 +2599,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- 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