From c8568764f692071f3588647575ea89f305e626fb Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 14 Oct 2023 16:36:45 +1100 Subject: [PATCH] Fix writing non-compound root NBT tags --- .../java/net/md_5/bungee/protocol/DefinedPacket.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/DefinedPacket.java b/protocol/src/main/java/net/md_5/bungee/protocol/DefinedPacket.java index c1017e606..d7f66e0d6 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/DefinedPacket.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/DefinedPacket.java @@ -325,9 +325,18 @@ public abstract class DefinedPacket public static void writeTag(Tag tag, ByteBuf output, int protocolVersion) { + DataOutputStream out = new DataOutputStream( new ByteBufOutputStream( output ) ); try { - tag.write( new DataOutputStream( new ByteBufOutputStream( output ) ) ); + if ( tag instanceof SpecificTag ) + { + SpecificTag specificTag = (SpecificTag) tag; + specificTag.writeType( out ); + specificTag.write( out ); + } else + { + tag.write( out ); + } } catch ( IOException ex ) { throw new RuntimeException( "Exception writing tag", ex );