Skip to content

Commit 65020c6

Browse files
committed
Temp fixup: 26.2 team packet
1 parent b4c5766 commit 65020c6

1 file changed

Lines changed: 153 additions & 0 deletions

File tree

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
From b846614076c953aafbc204a2816fef344065d139 Mon Sep 17 00:00:00 2001
2+
From: Shane Freeder <theboyetronic@gmail.com>
3+
Date: Mon, 15 Jun 2026 17:07:14 +0100
4+
Subject: [PATCH] Temp fixup: 26.2 team packet
5+
6+
7+
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Team.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Team.java
8+
index 6dfe6bd2..5915d4de 100644
9+
--- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Team.java
10+
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Team.java
11+
@@ -55,39 +55,46 @@ public class Team extends DefinedPacket
12+
mode = buf.readByte();
13+
if ( mode == 0 || mode == 2 )
14+
{
15+
- if ( protocolVersion < ProtocolConstants.MINECRAFT_1_13 )
16+
- {
17+
- displayName = readEitherBaseComponent( buf, protocolVersion, true );
18+
- prefix = readEitherBaseComponent( buf, protocolVersion, true );
19+
- suffix = readEitherBaseComponent( buf, protocolVersion, true );
20+
- } else
21+
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_26_2 )
22+
{
23+
+ // 26.2 reordered the parameters block: prefix/suffix follow displayName and friendlyFire moved to the end
24+
displayName = readEitherBaseComponent( buf, protocolVersion, false );
25+
- }
26+
- friendlyFire = buf.readByte();
27+
- if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_21_5 )
28+
- {
29+
+ prefix = readEitherBaseComponent( buf, protocolVersion, false );
30+
+ suffix = readEitherBaseComponent( buf, protocolVersion, false );
31+
nameTagVisibility = Either.right( NameTagVisibility.BY_ID[readVarInt( buf )] );
32+
collisionRule = Either.right( CollisionRule.BY_ID[readVarInt( buf )] );
33+
+ color = readOptional( DefinedPacket::readVarInt, buf );
34+
+ friendlyFire = buf.readByte();
35+
} else
36+
{
37+
- nameTagVisibility = Either.left( readString( buf ) );
38+
- if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
39+
+ if ( protocolVersion < ProtocolConstants.MINECRAFT_1_13 )
40+
+ {
41+
+ displayName = readEitherBaseComponent( buf, protocolVersion, true );
42+
+ prefix = readEitherBaseComponent( buf, protocolVersion, true );
43+
+ suffix = readEitherBaseComponent( buf, protocolVersion, true );
44+
+ } else
45+
{
46+
- collisionRule = Either.left( readString( buf ) );
47+
+ displayName = readEitherBaseComponent( buf, protocolVersion, false );
48+
+ }
49+
+ friendlyFire = buf.readByte();
50+
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_21_5 )
51+
+ {
52+
+ nameTagVisibility = Either.right( NameTagVisibility.BY_ID[readVarInt( buf )] );
53+
+ collisionRule = Either.right( CollisionRule.BY_ID[readVarInt( buf )] );
54+
+ } else
55+
+ {
56+
+ nameTagVisibility = Either.left( readString( buf ) );
57+
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
58+
+ {
59+
+ collisionRule = Either.left( readString( buf ) );
60+
+ }
61+
}
62+
- }
63+
- if ( protocolVersion >= ProtocolConstants.MINECRAFT_26_2 )
64+
- {
65+
- color = readOptional( DefinedPacket::readVarInt, buf );
66+
- } else
67+
- {
68+
color = Optional.of( ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 ) ? readVarInt( buf ) : buf.readByte() );
69+
- }
70+
- if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 )
71+
- {
72+
- prefix = readEitherBaseComponent( buf, protocolVersion, false );
73+
- suffix = readEitherBaseComponent( buf, protocolVersion, false );
74+
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 )
75+
+ {
76+
+ prefix = readEitherBaseComponent( buf, protocolVersion, false );
77+
+ suffix = readEitherBaseComponent( buf, protocolVersion, false );
78+
+ }
79+
}
80+
}
81+
if ( mode == 0 || mode == 3 || mode == 4 )
82+
@@ -108,37 +115,47 @@ public class Team extends DefinedPacket
83+
buf.writeByte( mode );
84+
if ( mode == 0 || mode == 2 )
85+
{
86+
- writeEitherBaseComponent( displayName, buf, protocolVersion );
87+
- if ( protocolVersion < ProtocolConstants.MINECRAFT_1_13 )
88+
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_26_2 )
89+
{
90+
+ // 26.2 reordered the parameters block: prefix/suffix follow displayName and friendlyFire moved to the end
91+
+ writeEitherBaseComponent( displayName, buf, protocolVersion );
92+
writeEitherBaseComponent( prefix, buf, protocolVersion );
93+
writeEitherBaseComponent( suffix, buf, protocolVersion );
94+
- }
95+
- buf.writeByte( friendlyFire );
96+
- if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_21_5 )
97+
- {
98+
writeVarInt( nameTagVisibility.getRight().ordinal(), buf );
99+
writeVarInt( collisionRule.getRight().ordinal(), buf );
100+
+ writeOptional( color, DefinedPacket::writeVarInt, buf );
101+
+ buf.writeByte( friendlyFire );
102+
} else
103+
{
104+
- writeString( nameTagVisibility.getLeft(), buf );
105+
- if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
106+
+ writeEitherBaseComponent( displayName, buf, protocolVersion );
107+
+ if ( protocolVersion < ProtocolConstants.MINECRAFT_1_13 )
108+
{
109+
- writeString( collisionRule.getLeft(), buf );
110+
+ writeEitherBaseComponent( prefix, buf, protocolVersion );
111+
+ writeEitherBaseComponent( suffix, buf, protocolVersion );
112+
+ }
113+
+ buf.writeByte( friendlyFire );
114+
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_21_5 )
115+
+ {
116+
+ writeVarInt( nameTagVisibility.getRight().ordinal(), buf );
117+
+ writeVarInt( collisionRule.getRight().ordinal(), buf );
118+
+ } else
119+
+ {
120+
+ writeString( nameTagVisibility.getLeft(), buf );
121+
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
122+
+ {
123+
+ writeString( collisionRule.getLeft(), buf );
124+
+ }
125+
}
126+
- }
127+
128+
- if ( protocolVersion >= ProtocolConstants.MINECRAFT_26_2 )
129+
- {
130+
- writeOptional( color, DefinedPacket::writeVarInt, buf );
131+
- } else if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 )
132+
- {
133+
- writeVarInt( color.get(), buf );
134+
- writeEitherBaseComponent( prefix, buf, protocolVersion );
135+
- writeEitherBaseComponent( suffix, buf, protocolVersion );
136+
- } else
137+
- {
138+
- buf.writeByte( color.get() );
139+
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 )
140+
+ {
141+
+ writeVarInt( color.get(), buf );
142+
+ writeEitherBaseComponent( prefix, buf, protocolVersion );
143+
+ writeEitherBaseComponent( suffix, buf, protocolVersion );
144+
+ } else
145+
+ {
146+
+ buf.writeByte( color.get() );
147+
+ }
148+
}
149+
}
150+
if ( mode == 0 || mode == 3 || mode == 4 )
151+
--
152+
2.54.0
153+

0 commit comments

Comments
 (0)