Fix UpdateTeamsPacket for 1.21.5+
SteamWarCI Build successful

This commit is contained in:
yoyosource
2026-05-21 08:35:30 +02:00
parent afc84b88ac
commit ebb9eb046d
@@ -20,7 +20,6 @@
package com.velocitypowered.proxy.protocol.packet;
import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils;
@@ -75,6 +74,8 @@ public class UpdateTeamsPacket implements MinecraftPacket {
ProtocolUtils.writeString(byteBuf, name);
byteBuf.writeByte(mode.ordinal());
ProtocolUtils.writeString(byteBuf, name);
byteBuf.writeByte(mode.ordinal());
switch (mode) {
case CREATE, UPDATE:
new ComponentHolder(protocolVersion, displayName).write(byteBuf);
@@ -82,9 +83,15 @@ public class UpdateTeamsPacket implements MinecraftPacket {
new ComponentHolder(protocolVersion, prefix).write(byteBuf);
new ComponentHolder(protocolVersion, suffix).write(byteBuf);
}
byteBuf.writeByte(friendlyFlags);
ProtocolUtils.writeString(byteBuf, nameTagVisibility.getValue());
ProtocolUtils.writeString(byteBuf, collisionRule.getValue());
if (protocolVersion.noLessThan(ProtocolVersion.MINECRAFT_1_21_5)) {
ProtocolUtils.writeVarInt(byteBuf, nameTagVisibility.ordinal());
ProtocolUtils.writeVarInt(byteBuf, collisionRule.ordinal());
} else {
ProtocolUtils.writeString(byteBuf, nameTagVisibility.getValue());
ProtocolUtils.writeString(byteBuf, collisionRule.getValue());
}
if (protocolVersion.greaterThan(ProtocolVersion.MINECRAFT_1_12_2)) {
ProtocolUtils.writeVarInt(byteBuf, color);
new ComponentHolder(protocolVersion, prefix).write(byteBuf);