13
0
geforkt von Mirrors/Velocity

Merge pull request #6 from kashike/magic

*kashike waves his wand*
Dieser Commit ist enthalten in:
Andrew Steinborn 2018-07-31 01:53:23 -04:00 committet von GitHub
Commit d62f2622ea
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
10 geänderte Dateien mit 118 neuen und 97 gelöschten Zeilen

Datei anzeigen

@ -87,7 +87,7 @@ public class ServerConnection implements MinecraftConnectionAssociation {
private void startHandshake() { private void startHandshake() {
// Initiate a handshake. // Initiate a handshake.
Handshake handshake = new Handshake(); Handshake handshake = new Handshake();
handshake.setNextStatus(2); // login handshake.setNextStatus(StateRegistry.LOGIN_ID);
handshake.setProtocolVersion(proxyPlayer.getConnection().getProtocolVersion()); handshake.setProtocolVersion(proxyPlayer.getConnection().getProtocolVersion());
if (VelocityServer.getServer().getConfiguration().getIpForwardingMode() == IPForwardingMode.LEGACY) { if (VelocityServer.getServer().getConfiguration().getIpForwardingMode() == IPForwardingMode.LEGACY) {
handshake.setServerAddress(createBungeeForwardingAddress()); handshake.setServerAddress(createBungeeForwardingAddress());

Datei anzeigen

@ -257,13 +257,16 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
if (packet instanceof ScoreboardObjective) { if (packet instanceof ScoreboardObjective) {
ScoreboardObjective so = (ScoreboardObjective) packet; ScoreboardObjective so = (ScoreboardObjective) packet;
if (so.getMode() == 0) { switch (so.getMode()) {
Objective o = new Objective(so.getId()); case ScoreboardObjective.ADD:
o.setDisplayName(so.getDisplayName()); Objective o = new Objective(so.getId());
o.setType(so.getType()); o.setDisplayName(so.getDisplayName());
serverScoreboard.getObjectives().put(so.getId(), o); o.setType(so.getType());
} else { serverScoreboard.getObjectives().put(so.getId(), o);
serverScoreboard.getObjectives().remove(so.getId()); break;
case ScoreboardObjective.REMOVE:
serverScoreboard.getObjectives().remove(so.getId());
break;
} }
} }
@ -274,11 +277,11 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
return; return;
} }
switch (sss.getAction()) { switch (sss.getAction()) {
case 0: case ScoreboardSetScore.CHANGE:
Score score = new Score(sss.getEntity(), sss.getValue()); Score score = new Score(sss.getEntity(), sss.getValue());
objective.getScores().put(sss.getEntity(), score); objective.getScores().put(sss.getEntity(), score);
break; break;
case 1: case ScoreboardSetScore.REMOVE:
objective.getScores().remove(sss.getEntity()); objective.getScores().remove(sss.getEntity());
break; break;
} }
@ -287,12 +290,12 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
if (packet instanceof ScoreboardTeam) { if (packet instanceof ScoreboardTeam) {
ScoreboardTeam st = (ScoreboardTeam) packet; ScoreboardTeam st = (ScoreboardTeam) packet;
switch (st.getMode()) { switch (st.getMode()) {
case 0: case ScoreboardTeam.ADD:
// TODO: Preserve other team information? We might not need to... // TODO: Preserve other team information? We might not need to...
Team team = new Team(st.getId()); Team team = new Team(st.getId());
serverScoreboard.getTeams().put(st.getId(), team); serverScoreboard.getTeams().put(st.getId(), team);
break; break;
case 1: case ScoreboardTeam.REMOVE:
serverScoreboard.getTeams().remove(st.getId()); serverScoreboard.getTeams().remove(st.getId());
break; break;
} }
@ -304,21 +307,21 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
for (Score score : objective.getScores().values()) { for (Score score : objective.getScores().values()) {
ScoreboardSetScore sss = new ScoreboardSetScore(); ScoreboardSetScore sss = new ScoreboardSetScore();
sss.setObjective(objective.getId()); sss.setObjective(objective.getId());
sss.setAction((byte) 1); sss.setAction(ScoreboardSetScore.REMOVE);
sss.setEntity(score.getTarget()); sss.setEntity(score.getTarget());
player.getConnection().delayedWrite(sss); player.getConnection().delayedWrite(sss);
} }
ScoreboardObjective so = new ScoreboardObjective(); ScoreboardObjective so = new ScoreboardObjective();
so.setId(objective.getId()); so.setId(objective.getId());
so.setMode((byte) 1); so.setMode(ScoreboardObjective.REMOVE);
player.getConnection().delayedWrite(so); player.getConnection().delayedWrite(so);
} }
for (Team team : serverScoreboard.getTeams().values()) { for (Team team : serverScoreboard.getTeams().values()) {
ScoreboardTeam st = new ScoreboardTeam(); ScoreboardTeam st = new ScoreboardTeam();
st.setId(team.getId()); st.setId(team.getId());
st.setMode((byte) 1); st.setMode(ScoreboardTeam.REMOVE);
player.getConnection().delayedWrite(st); player.getConnection().delayedWrite(st);
} }

Datei anzeigen

@ -25,13 +25,12 @@ public class HandshakeSessionHandler implements MinecraftSessionHandler {
Handshake handshake = (Handshake) packet; Handshake handshake = (Handshake) packet;
switch (handshake.getNextStatus()) { switch (handshake.getNextStatus()) {
case 1: case StateRegistry.STATUS_ID:
// Status protocol
connection.setState(StateRegistry.STATUS); connection.setState(StateRegistry.STATUS);
connection.setProtocolVersion(handshake.getProtocolVersion()); connection.setProtocolVersion(handshake.getProtocolVersion());
connection.setSessionHandler(new StatusSessionHandler(connection)); connection.setSessionHandler(new StatusSessionHandler(connection));
break; break;
case 2: case StateRegistry.LOGIN_ID:
connection.setState(StateRegistry.LOGIN); connection.setState(StateRegistry.LOGIN);
connection.setProtocolVersion(handshake.getProtocolVersion()); connection.setProtocolVersion(handshake.getProtocolVersion());
if (!ProtocolConstants.isSupported(handshake.getProtocolVersion())) { if (!ProtocolConstants.isSupported(handshake.getProtocolVersion())) {

Datei anzeigen

@ -124,6 +124,8 @@ public enum StateRegistry {
} }
}; };
public static final int STATUS_ID = 1;
public static final int LOGIN_ID = 2;
public final PacketRegistry CLIENTBOUND = new PacketRegistry(ProtocolConstants.Direction.CLIENTBOUND, this); public final PacketRegistry CLIENTBOUND = new PacketRegistry(ProtocolConstants.Direction.CLIENTBOUND, this);
public final PacketRegistry SERVERBOUND = new PacketRegistry(ProtocolConstants.Direction.SERVERBOUND, this); public final PacketRegistry SERVERBOUND = new PacketRegistry(ProtocolConstants.Direction.SERVERBOUND, this);

Datei anzeigen

@ -8,12 +8,18 @@ import io.netty.buffer.ByteBuf;
import java.util.UUID; import java.util.UUID;
public class BossBar implements MinecraftPacket { public class BossBar implements MinecraftPacket {
public static final int ADD = 0;
public static final int REMOVE = 1;
public static final int UPDATE_PERCENT = 2;
public static final int UPDATE_NAME = 3;
public static final int UPDATE_STYLE = 4;
public static final int UPDATE_PROPERTIES = 5;
private UUID uuid; private UUID uuid;
private int action; private int action;
private String title; private String name;
private float health; private float percent;
private int color; private int color;
private int divisions; private int overlay;
private short flags; private short flags;
public UUID getUuid() { public UUID getUuid() {
@ -32,20 +38,20 @@ public class BossBar implements MinecraftPacket {
this.action = action; this.action = action;
} }
public String getTitle() { public String getName() {
return title; return name;
} }
public void setTitle(String title) { public void setName(String name) {
this.title = title; this.name = name;
} }
public float getHealth() { public float getPercent() {
return health; return percent;
} }
public void setHealth(float health) { public void setPercent(float percent) {
this.health = health; this.percent = percent;
} }
public int getColor() { public int getColor() {
@ -56,12 +62,12 @@ public class BossBar implements MinecraftPacket {
this.color = color; this.color = color;
} }
public int getDivisions() { public int getOverlay() {
return divisions; return overlay;
} }
public void setDivisions(int divisions) { public void setOverlay(int overlay) {
this.divisions = divisions; this.overlay = overlay;
} }
public short getFlags() { public short getFlags() {
@ -77,10 +83,10 @@ public class BossBar implements MinecraftPacket {
return "BossBar{" + return "BossBar{" +
"uuid=" + uuid + "uuid=" + uuid +
", action=" + action + ", action=" + action +
", title='" + title + '\'' + ", name='" + name + '\'' +
", health=" + health + ", percent=" + percent +
", color=" + color + ", color=" + color +
", divisions=" + divisions + ", overlay=" + overlay +
", flags=" + flags + ", flags=" + flags +
'}'; '}';
} }
@ -90,26 +96,26 @@ public class BossBar implements MinecraftPacket {
this.uuid = ProtocolUtils.readUuid(buf); this.uuid = ProtocolUtils.readUuid(buf);
this.action = ProtocolUtils.readVarInt(buf); this.action = ProtocolUtils.readVarInt(buf);
switch (action) { switch (action) {
case 0: // add case ADD:
this.title = ProtocolUtils.readString(buf); this.name = ProtocolUtils.readString(buf);
this.health = buf.readFloat(); this.percent = buf.readFloat();
this.color = ProtocolUtils.readVarInt(buf); this.color = ProtocolUtils.readVarInt(buf);
this.divisions = ProtocolUtils.readVarInt(buf); this.overlay = ProtocolUtils.readVarInt(buf);
this.flags = buf.readUnsignedByte(); this.flags = buf.readUnsignedByte();
break; break;
case 1: // remove case REMOVE:
break; break;
case 2: // set health case UPDATE_PERCENT:
this.health = buf.readFloat(); this.percent = buf.readFloat();
break; break;
case 3: // update title case UPDATE_NAME:
this.title = ProtocolUtils.readString(buf); this.name = ProtocolUtils.readString(buf);
break; break;
case 4: // update style case UPDATE_STYLE:
this.color = ProtocolUtils.readVarInt(buf); this.color = ProtocolUtils.readVarInt(buf);
this.divisions = ProtocolUtils.readVarInt(buf); this.overlay = ProtocolUtils.readVarInt(buf);
break; break;
case 5: case UPDATE_PROPERTIES:
this.flags = buf.readUnsignedByte(); this.flags = buf.readUnsignedByte();
break; break;
} }
@ -120,26 +126,26 @@ public class BossBar implements MinecraftPacket {
ProtocolUtils.writeUuid(buf, uuid); ProtocolUtils.writeUuid(buf, uuid);
ProtocolUtils.writeVarInt(buf, action); ProtocolUtils.writeVarInt(buf, action);
switch (action) { switch (action) {
case 0: // add case ADD:
ProtocolUtils.writeString(buf, title); ProtocolUtils.writeString(buf, name);
buf.writeFloat(health); buf.writeFloat(percent);
ProtocolUtils.writeVarInt(buf, color); ProtocolUtils.writeVarInt(buf, color);
ProtocolUtils.writeVarInt(buf, divisions); ProtocolUtils.writeVarInt(buf, overlay);
buf.writeByte(flags); buf.writeByte(flags);
break; break;
case 1: // remove case REMOVE:
break; break;
case 2: // set health case UPDATE_PERCENT:
buf.writeFloat(health); buf.writeFloat(percent);
break; break;
case 3: // update title case UPDATE_NAME:
ProtocolUtils.writeString(buf, title); ProtocolUtils.writeString(buf, name);
break; break;
case 4: // update style case UPDATE_STYLE:
ProtocolUtils.writeVarInt(buf, color); ProtocolUtils.writeVarInt(buf, color);
ProtocolUtils.writeVarInt(buf, divisions); ProtocolUtils.writeVarInt(buf, overlay);
break; break;
case 5: case UPDATE_PROPERTIES:
buf.writeByte(flags); buf.writeByte(flags);
break; break;
} }

Datei anzeigen

@ -9,15 +9,16 @@ import net.kyori.text.Component;
import net.kyori.text.serializer.ComponentSerializers; import net.kyori.text.serializer.ComponentSerializers;
public class Chat implements MinecraftPacket { public class Chat implements MinecraftPacket {
public static final byte CHAT = (byte) 0;
private String message; private String message;
private byte position; private byte type;
public Chat() { public Chat() {
} }
public Chat(String message, byte position) { public Chat(String message, byte type) {
this.message = message; this.message = message;
this.position = position; this.type = type;
} }
public String getMessage() { public String getMessage() {
@ -28,19 +29,19 @@ public class Chat implements MinecraftPacket {
this.message = message; this.message = message;
} }
public byte getPosition() { public byte getType() {
return position; return type;
} }
public void setPosition(byte position) { public void setType(byte type) {
this.position = position; this.type = type;
} }
@Override @Override
public String toString() { public String toString() {
return "Chat{" + return "Chat{" +
"message='" + message + '\'' + "message='" + message + '\'' +
", position=" + position + ", type=" + type +
'}'; '}';
} }
@ -48,7 +49,7 @@ public class Chat implements MinecraftPacket {
public void decode(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) { public void decode(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
message = ProtocolUtils.readString(buf); message = ProtocolUtils.readString(buf);
if (direction == ProtocolConstants.Direction.CLIENTBOUND) { if (direction == ProtocolConstants.Direction.CLIENTBOUND) {
position = buf.readByte(); type = buf.readByte();
} }
} }
@ -56,16 +57,16 @@ public class Chat implements MinecraftPacket {
public void encode(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) { public void encode(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
ProtocolUtils.writeString(buf, message); ProtocolUtils.writeString(buf, message);
if (direction == ProtocolConstants.Direction.CLIENTBOUND) { if (direction == ProtocolConstants.Direction.CLIENTBOUND) {
buf.writeByte(position); buf.writeByte(type);
} }
} }
public static Chat create(Component component) { public static Chat create(Component component) {
return create(component, (byte) 0); return create(component, CHAT);
} }
public static Chat create(Component component, byte pos) { public static Chat create(Component component, byte type) {
Preconditions.checkNotNull(component, "component"); Preconditions.checkNotNull(component, "component");
return new Chat(ComponentSerializers.JSON.serialize(component), pos); return new Chat(ComponentSerializers.JSON.serialize(component), type);
} }
} }

Datei anzeigen

@ -8,7 +8,7 @@ import io.netty.buffer.ByteBuf;
public class ClientSettings implements MinecraftPacket { public class ClientSettings implements MinecraftPacket {
private String locale; private String locale;
private byte viewDistance; private byte viewDistance;
private int chatMode; private int chatVisibility;
private boolean chatColors; private boolean chatColors;
private short skinParts; private short skinParts;
private int mainHand; private int mainHand;
@ -29,12 +29,12 @@ public class ClientSettings implements MinecraftPacket {
this.viewDistance = viewDistance; this.viewDistance = viewDistance;
} }
public int getChatMode() { public int getChatVisibility() {
return chatMode; return chatVisibility;
} }
public void setChatMode(int chatMode) { public void setChatVisibility(int chatVisibility) {
this.chatMode = chatMode; this.chatVisibility = chatVisibility;
} }
public boolean isChatColors() { public boolean isChatColors() {
@ -66,7 +66,7 @@ public class ClientSettings implements MinecraftPacket {
return "ClientSettings{" + return "ClientSettings{" +
"locale='" + locale + '\'' + "locale='" + locale + '\'' +
", viewDistance=" + viewDistance + ", viewDistance=" + viewDistance +
", chatMode=" + chatMode + ", chatVisibility=" + chatVisibility +
", chatColors=" + chatColors + ", chatColors=" + chatColors +
", skinParts=" + skinParts + ", skinParts=" + skinParts +
", mainHand=" + mainHand + ", mainHand=" + mainHand +
@ -77,7 +77,7 @@ public class ClientSettings implements MinecraftPacket {
public void decode(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) { public void decode(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
this.locale = ProtocolUtils.readString(buf, 16); this.locale = ProtocolUtils.readString(buf, 16);
this.viewDistance = buf.readByte(); this.viewDistance = buf.readByte();
this.chatMode = ProtocolUtils.readVarInt(buf); this.chatVisibility = ProtocolUtils.readVarInt(buf);
this.chatColors = buf.readBoolean(); this.chatColors = buf.readBoolean();
this.skinParts = buf.readUnsignedByte(); this.skinParts = buf.readUnsignedByte();
this.mainHand = ProtocolUtils.readVarInt(buf); this.mainHand = ProtocolUtils.readVarInt(buf);
@ -87,7 +87,7 @@ public class ClientSettings implements MinecraftPacket {
public void encode(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) { public void encode(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
ProtocolUtils.writeString(buf, locale); ProtocolUtils.writeString(buf, locale);
buf.writeByte(viewDistance); buf.writeByte(viewDistance);
ProtocolUtils.writeVarInt(buf, chatMode); ProtocolUtils.writeVarInt(buf, chatVisibility);
buf.writeBoolean(chatColors); buf.writeBoolean(chatColors);
buf.writeByte(skinParts); buf.writeByte(skinParts);
ProtocolUtils.writeVarInt(buf, mainHand); ProtocolUtils.writeVarInt(buf, mainHand);

Datei anzeigen

@ -9,6 +9,9 @@ import io.netty.buffer.ByteBuf;
import net.kyori.text.Component; import net.kyori.text.Component;
public class ScoreboardObjective implements MinecraftPacket { public class ScoreboardObjective implements MinecraftPacket {
public static final byte ADD = (byte) 0;
public static final byte REMOVE = (byte) 1;
public static final byte CHANGE = (byte) 2;
private String id; private String id;
private byte mode; private byte mode;
private Component displayName; private Component displayName;
@ -60,7 +63,7 @@ public class ScoreboardObjective implements MinecraftPacket {
public void decode(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) { public void decode(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
this.id = ProtocolUtils.readString(buf, 16); this.id = ProtocolUtils.readString(buf, 16);
this.mode = buf.readByte(); this.mode = buf.readByte();
if (this.mode != 1) { if (this.mode != REMOVE) {
this.displayName = ProtocolUtils.readScoreboardTextComponent(buf, protocolVersion); this.displayName = ProtocolUtils.readScoreboardTextComponent(buf, protocolVersion);
if (protocolVersion >= ProtocolConstants.MINECRAFT_1_13) { if (protocolVersion >= ProtocolConstants.MINECRAFT_1_13) {
this.type = ScoreboardProtocolUtil.getMode(ProtocolUtils.readVarInt(buf)); this.type = ScoreboardProtocolUtil.getMode(ProtocolUtils.readVarInt(buf));
@ -74,7 +77,7 @@ public class ScoreboardObjective implements MinecraftPacket {
public void encode(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) { public void encode(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
ProtocolUtils.writeString(buf, id); ProtocolUtils.writeString(buf, id);
buf.writeByte(mode); buf.writeByte(mode);
if (this.mode != 1) { if (this.mode != REMOVE) {
ProtocolUtils.writeScoreboardTextComponent(buf, protocolVersion, displayName); ProtocolUtils.writeScoreboardTextComponent(buf, protocolVersion, displayName);
if (protocolVersion >= ProtocolConstants.MINECRAFT_1_13) { if (protocolVersion >= ProtocolConstants.MINECRAFT_1_13) {
ProtocolUtils.writeVarInt(buf, type.ordinal()); ProtocolUtils.writeVarInt(buf, type.ordinal());

Datei anzeigen

@ -6,6 +6,8 @@ import com.velocitypowered.proxy.protocol.ProtocolUtils;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public class ScoreboardSetScore implements MinecraftPacket { public class ScoreboardSetScore implements MinecraftPacket {
public static final byte CHANGE = (byte) 0;
public static final byte REMOVE = (byte) 1;
private String entity; private String entity;
private byte action; private byte action;
private String objective; private String objective;
@ -58,7 +60,7 @@ public class ScoreboardSetScore implements MinecraftPacket {
this.entity = ProtocolUtils.readString(buf, 40); this.entity = ProtocolUtils.readString(buf, 40);
this.action = buf.readByte(); this.action = buf.readByte();
this.objective = ProtocolUtils.readString(buf, 16); this.objective = ProtocolUtils.readString(buf, 16);
if (this.action != 1) { if (this.action != REMOVE) {
value = ProtocolUtils.readVarInt(buf); value = ProtocolUtils.readVarInt(buf);
} }
} }
@ -68,7 +70,7 @@ public class ScoreboardSetScore implements MinecraftPacket {
ProtocolUtils.writeString(buf, entity); ProtocolUtils.writeString(buf, entity);
buf.writeByte(action); buf.writeByte(action);
ProtocolUtils.writeString(buf, objective); ProtocolUtils.writeString(buf, objective);
if (this.action != 1) { if (this.action != REMOVE) {
ProtocolUtils.writeVarInt(buf, value); ProtocolUtils.writeVarInt(buf, value);
} }
} }

Datei anzeigen

@ -10,6 +10,11 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class ScoreboardTeam implements MinecraftPacket { public class ScoreboardTeam implements MinecraftPacket {
public static final byte ADD = (byte) 0;
public static final byte REMOVE = (byte) 1;
public static final byte UPDATE = (byte) 2;
public static final byte ADD_PLAYER = (byte) 3;
public static final byte REMOVE_PLAYER = (byte) 4;
private String id; private String id;
private byte mode; private byte mode;
@ -124,8 +129,8 @@ public class ScoreboardTeam implements MinecraftPacket {
this.mode = buf.readByte(); this.mode = buf.readByte();
switch (mode) { switch (mode) {
case 0: // create case ADD:
case 2: // update case UPDATE:
this.displayName = ProtocolUtils.readScoreboardTextComponent(buf, protocolVersion); this.displayName = ProtocolUtils.readScoreboardTextComponent(buf, protocolVersion);
if (protocolVersion <= ProtocolConstants.MINECRAFT_1_12_2) { if (protocolVersion <= ProtocolConstants.MINECRAFT_1_12_2) {
this.prefix = ProtocolUtils.readScoreboardTextComponent(buf, protocolVersion); this.prefix = ProtocolUtils.readScoreboardTextComponent(buf, protocolVersion);
@ -140,14 +145,14 @@ public class ScoreboardTeam implements MinecraftPacket {
this.prefix = ProtocolUtils.readScoreboardTextComponent(buf, protocolVersion); this.prefix = ProtocolUtils.readScoreboardTextComponent(buf, protocolVersion);
this.suffix = ProtocolUtils.readScoreboardTextComponent(buf, protocolVersion); this.suffix = ProtocolUtils.readScoreboardTextComponent(buf, protocolVersion);
} }
if (mode == 0) { if (mode == ADD) {
this.entities = readEntities(buf); this.entities = readEntities(buf);
} }
break; break;
case 1: // remove case REMOVE: // remove
break; break;
case 3: // add player case ADD_PLAYER: // add player
case 4: // remove player case REMOVE_PLAYER: // remove player
this.entities = readEntities(buf); this.entities = readEntities(buf);
break; break;
} }
@ -158,8 +163,8 @@ public class ScoreboardTeam implements MinecraftPacket {
ProtocolUtils.writeString(buf, id); ProtocolUtils.writeString(buf, id);
buf.writeByte(mode); buf.writeByte(mode);
switch (mode) { switch (mode) {
case 0: // create case ADD:
case 2: // update case UPDATE:
ProtocolUtils.writeScoreboardTextComponent(buf, protocolVersion, displayName); ProtocolUtils.writeScoreboardTextComponent(buf, protocolVersion, displayName);
if (protocolVersion <= ProtocolConstants.MINECRAFT_1_12_2) { if (protocolVersion <= ProtocolConstants.MINECRAFT_1_12_2) {
ProtocolUtils.writeScoreboardTextComponent(buf, protocolVersion, prefix); ProtocolUtils.writeScoreboardTextComponent(buf, protocolVersion, prefix);
@ -175,14 +180,14 @@ public class ScoreboardTeam implements MinecraftPacket {
} else { } else {
buf.writeByte(color); buf.writeByte(color);
} }
if (mode == 0) { if (mode == ADD) {
writeEntities(buf, entities); writeEntities(buf, entities);
} }
break; break;
case 1: case REMOVE:
break; break;
case 3: case ADD_PLAYER:
case 4: case REMOVE_PLAYER:
writeEntities(buf, entities); writeEntities(buf, entities);
break; break;
} }