diff --git a/patches/api/Adventure.patch b/patches/api/Adventure.patch index 8c986aba43..cb867214dd 100644 --- a/patches/api/Adventure.patch +++ b/patches/api/Adventure.patch @@ -3231,6 +3231,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java +++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java @@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; + * Stores details for players attempting to log in. + *

+ * This event is asynchronous, and not run using main thread. ++ *

++ * When this event is fired, the player's locale is not ++ * available. Therefore, any translatable component will be ++ * rendered with the default locale, {@link java.util.Locale#US}. ++ *

++ * Consider rendering any translatable yourself with {@link net.kyori.adventure.translation.GlobalTranslator#render} ++ * if the client's language is known. + */ public class AsyncPlayerPreLoginEvent extends Event { private static final HandlerList handlers = new HandlerList(); private Result result; @@ -3738,6 +3749,20 @@ diff --git a/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java b/sr index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java +@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; + + /** + * Stores details for players attempting to log in ++ *

++ * When this event is fired, the player's locale is not ++ * available. Therefore, any translatable component will be ++ * rendered with the default locale, {@link java.util.Locale#US}. ++ *

++ * Consider rendering any translatable yourself with {@link net.kyori.adventure.translation.GlobalTranslator#render} ++ * if the client's language is known. + * + * @deprecated This event causes synchronization from the login thread; {@link + * AsyncPlayerPreLoginEvent} is preferred to keep the secondary threads @@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; public class PlayerPreLoginEvent extends Event { private static final HandlerList handlers = new HandlerList(); diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index f5e9b0e652..d4ead9c635 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -2167,6 +2167,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static final short MAX_STRING_LENGTH = 32767; public static final int MAX_COMPONENT_STRING_LENGTH = 262144; private static final int PUBLIC_KEY_SIZE = 256; +@@ -0,0 +0,0 @@ public class FriendlyByteBuf extends ByteBuf { + } + + public void writeJsonWithCodec(Codec codec, T value) { ++ // Paper start - Adventure ++ this.writeJsonWithCodec(codec, value, MAX_STRING_LENGTH); ++ } ++ public void writeJsonWithCodec(Codec codec, T value, int maxLength) { ++ // Paper end - Adventure + DataResult dataresult = codec.encodeStart(JsonOps.INSTANCE, value); + + this.writeUtf(FriendlyByteBuf.GSON.toJson((JsonElement) Util.getOrThrow(dataresult, (s) -> { + return new EncoderException("Failed to encode: " + s + " " + value); +- }))); ++ })), maxLength); // Paper - Adventure + } + + public void writeId(IdMap registry, T value) { @@ -0,0 +0,0 @@ public class FriendlyByteBuf extends ByteBuf { return (Component) this.readWithCodecTrusted(NbtOps.INSTANCE, ComponentSerialization.CODEC); } @@ -2605,6 +2623,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 buf.writeComponent(this.header); buf.writeComponent(this.footer); } +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/network/protocol/login/ClientboundLoginDisconnectPacket.java ++++ b/src/main/java/net/minecraft/network/protocol/login/ClientboundLoginDisconnectPacket.java +@@ -0,0 +0,0 @@ public class ClientboundLoginDisconnectPacket implements Packet