geforkt von Mirrors/Velocity
Remove scoreboard packets
We don't use these any more, and to be frank, it's kind of scary to update anyway.
Dieser Commit ist enthalten in:
Ursprung
6c61aa49f3
Commit
c89f3ea468
@ -112,30 +112,6 @@ public enum StateRegistry {
|
||||
map(0x49, MINECRAFT_1_12, true),
|
||||
map(0x4A, MINECRAFT_1_12_1, true),
|
||||
map(0x4E, MINECRAFT_1_13, true));
|
||||
CLIENTBOUND.register(ScoreboardDisplay.class, ScoreboardDisplay::new,
|
||||
map(0x3D, MINECRAFT_1_8, true),
|
||||
map(0x38, MINECRAFT_1_9, true),
|
||||
map(0x3A, MINECRAFT_1_12, true),
|
||||
map(0x3B, MINECRAFT_1_12_1, true),
|
||||
map(0x3E, MINECRAFT_1_13, true));
|
||||
CLIENTBOUND.register(ScoreboardObjective.class, ScoreboardObjective::new,
|
||||
map(0x3B, MINECRAFT_1_8, true),
|
||||
map(0x3F, MINECRAFT_1_9, true),
|
||||
map(0x41, MINECRAFT_1_12, true),
|
||||
map(0x42, MINECRAFT_1_12_1, true),
|
||||
map(0x45, MINECRAFT_1_13, true));
|
||||
CLIENTBOUND.register(ScoreboardTeam.class, ScoreboardTeam::new,
|
||||
map(0x3E, MINECRAFT_1_8, true),
|
||||
map(0x41, MINECRAFT_1_9, true),
|
||||
map(0x43, MINECRAFT_1_12, true),
|
||||
map(0x44, MINECRAFT_1_12_1, true),
|
||||
map(0x47, MINECRAFT_1_13, true));
|
||||
CLIENTBOUND.register(ScoreboardSetScore.class, ScoreboardSetScore::new,
|
||||
map(0x3C, MINECRAFT_1_8, true),
|
||||
map(0x42, MINECRAFT_1_9, true),
|
||||
map(0x44, MINECRAFT_1_12, true),
|
||||
map(0x45, MINECRAFT_1_12_1, true),
|
||||
map(0x48, MINECRAFT_1_13, true));
|
||||
CLIENTBOUND.register(TitlePacket.class, TitlePacket::new,
|
||||
map(0x45, MINECRAFT_1_8, true),
|
||||
map(0x45, MINECRAFT_1_9, true),
|
||||
|
@ -1,47 +0,0 @@
|
||||
package com.velocitypowered.proxy.protocol.packet;
|
||||
|
||||
import com.velocitypowered.proxy.protocol.MinecraftPacket;
|
||||
import com.velocitypowered.proxy.protocol.ProtocolConstants;
|
||||
import com.velocitypowered.proxy.protocol.ProtocolUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class ScoreboardDisplay implements MinecraftPacket {
|
||||
private byte position;
|
||||
private String displayName;
|
||||
|
||||
public byte getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public void setPosition(byte position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public void setDisplayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ScoreboardDisplay{" +
|
||||
"position=" + position +
|
||||
", displayName='" + displayName + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
|
||||
this.position = buf.readByte();
|
||||
this.displayName = ProtocolUtils.readString(buf, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
|
||||
buf.writeByte(position);
|
||||
ProtocolUtils.writeString(buf, displayName);
|
||||
}
|
||||
}
|
@ -1,93 +0,0 @@
|
||||
package com.velocitypowered.proxy.protocol.packet;
|
||||
|
||||
import com.velocitypowered.proxy.protocol.MinecraftPacket;
|
||||
import com.velocitypowered.proxy.protocol.ProtocolConstants;
|
||||
import com.velocitypowered.proxy.protocol.ProtocolUtils;
|
||||
import com.velocitypowered.proxy.protocol.util.ScoreboardProtocolUtil;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.kyori.text.Component;
|
||||
|
||||
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 byte mode;
|
||||
private Component displayName;
|
||||
private ObjectiveMode type;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public byte getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
public void setMode(byte mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
public Component getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public void setDisplayName(Component displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public ObjectiveMode getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(ObjectiveMode type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ScoreboardObjective{" +
|
||||
"id='" + id + '\'' +
|
||||
", mode=" + mode +
|
||||
", displayName='" + displayName + '\'' +
|
||||
", type='" + type + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
|
||||
this.id = ProtocolUtils.readString(buf, 16);
|
||||
this.mode = buf.readByte();
|
||||
if (this.mode != REMOVE) {
|
||||
this.displayName = ProtocolUtils.readScoreboardTextComponent(buf, protocolVersion);
|
||||
if (protocolVersion >= ProtocolConstants.MINECRAFT_1_13) {
|
||||
this.type = ScoreboardProtocolUtil.getMode(ProtocolUtils.readVarInt(buf));
|
||||
} else {
|
||||
this.type = ScoreboardProtocolUtil.getMode(ProtocolUtils.readString(buf));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
|
||||
ProtocolUtils.writeString(buf, id);
|
||||
buf.writeByte(mode);
|
||||
if (this.mode != REMOVE) {
|
||||
ProtocolUtils.writeScoreboardTextComponent(buf, protocolVersion, displayName);
|
||||
if (protocolVersion >= ProtocolConstants.MINECRAFT_1_13) {
|
||||
ProtocolUtils.writeVarInt(buf, type.ordinal());
|
||||
} else {
|
||||
ProtocolUtils.writeString(buf, type.name().toLowerCase());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum ObjectiveMode {
|
||||
INTEGER,
|
||||
HEARTS
|
||||
}
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
package com.velocitypowered.proxy.protocol.packet;
|
||||
|
||||
import com.velocitypowered.proxy.protocol.MinecraftPacket;
|
||||
import com.velocitypowered.proxy.protocol.ProtocolConstants;
|
||||
import com.velocitypowered.proxy.protocol.ProtocolUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class ScoreboardSetScore implements MinecraftPacket {
|
||||
public static final byte CHANGE = (byte) 0;
|
||||
public static final byte REMOVE = (byte) 1;
|
||||
private String entity;
|
||||
private byte action;
|
||||
private String objective;
|
||||
private int value;
|
||||
|
||||
public String getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public void setEntity(String entity) {
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
public byte getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(byte action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public String getObjective() {
|
||||
return objective;
|
||||
}
|
||||
|
||||
public void setObjective(String objective) {
|
||||
this.objective = objective;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ScoreboardSetScore{" +
|
||||
"entity='" + entity + '\'' +
|
||||
", action=" + action +
|
||||
", objective='" + objective + '\'' +
|
||||
", value=" + value +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
|
||||
this.entity = ProtocolUtils.readString(buf, 40);
|
||||
this.action = buf.readByte();
|
||||
this.objective = ProtocolUtils.readString(buf, 16);
|
||||
if (this.action != REMOVE) {
|
||||
value = ProtocolUtils.readVarInt(buf);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
|
||||
ProtocolUtils.writeString(buf, entity);
|
||||
buf.writeByte(action);
|
||||
ProtocolUtils.writeString(buf, objective);
|
||||
if (this.action != REMOVE) {
|
||||
ProtocolUtils.writeVarInt(buf, value);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,215 +0,0 @@
|
||||
package com.velocitypowered.proxy.protocol.packet;
|
||||
|
||||
import com.velocitypowered.proxy.protocol.MinecraftPacket;
|
||||
import com.velocitypowered.proxy.protocol.ProtocolConstants;
|
||||
import com.velocitypowered.proxy.protocol.ProtocolUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.kyori.text.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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 byte mode;
|
||||
|
||||
private Component displayName;
|
||||
private Component prefix;
|
||||
private Component suffix;
|
||||
private byte flags;
|
||||
private String nameTagVisibility;
|
||||
private String collisionRule;
|
||||
private int color;
|
||||
private List<String> entities;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public byte getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
public void setMode(byte mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
public Component getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public void setDisplayName(Component displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public Component getPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
public void setPrefix(Component prefix) {
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
public Component getSuffix() {
|
||||
return suffix;
|
||||
}
|
||||
|
||||
public void setSuffix(Component suffix) {
|
||||
this.suffix = suffix;
|
||||
}
|
||||
|
||||
public byte getFlags() {
|
||||
return flags;
|
||||
}
|
||||
|
||||
public void setFlags(byte flags) {
|
||||
this.flags = flags;
|
||||
}
|
||||
|
||||
public String getNameTagVisibility() {
|
||||
return nameTagVisibility;
|
||||
}
|
||||
|
||||
public void setNameTagVisibility(String nameTagVisibility) {
|
||||
this.nameTagVisibility = nameTagVisibility;
|
||||
}
|
||||
|
||||
public String getCollisionRule() {
|
||||
return collisionRule;
|
||||
}
|
||||
|
||||
public void setCollisionRule(String collisionRule) {
|
||||
this.collisionRule = collisionRule;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(int color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public List<String> getEntities() {
|
||||
return entities;
|
||||
}
|
||||
|
||||
public void setEntities(List<String> entities) {
|
||||
this.entities = entities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ScoreboardTeam{" +
|
||||
"id='" + id + '\'' +
|
||||
", mode=" + mode +
|
||||
", displayName='" + displayName + '\'' +
|
||||
", prefix='" + prefix + '\'' +
|
||||
", suffix='" + suffix + '\'' +
|
||||
", flags=" + flags +
|
||||
", nameTagVisibility='" + nameTagVisibility + '\'' +
|
||||
", collisionRule='" + collisionRule + '\'' +
|
||||
", color=" + color +
|
||||
", entities=" + entities +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
|
||||
this.id = ProtocolUtils.readString(buf, 16);
|
||||
this.mode = buf.readByte();
|
||||
|
||||
switch (mode) {
|
||||
case ADD:
|
||||
case UPDATE:
|
||||
this.displayName = ProtocolUtils.readScoreboardTextComponent(buf, protocolVersion);
|
||||
if (protocolVersion <= ProtocolConstants.MINECRAFT_1_12_2) {
|
||||
this.prefix = ProtocolUtils.readScoreboardTextComponent(buf, protocolVersion);
|
||||
this.suffix = ProtocolUtils.readScoreboardTextComponent(buf, protocolVersion);
|
||||
}
|
||||
this.flags = buf.readByte();
|
||||
this.nameTagVisibility = ProtocolUtils.readString(buf, 32);
|
||||
if (protocolVersion >= ProtocolConstants.MINECRAFT_1_9) {
|
||||
this.collisionRule = ProtocolUtils.readString(buf, 32);
|
||||
}
|
||||
this.color = protocolVersion <= ProtocolConstants.MINECRAFT_1_12_2 ? buf.readByte() :
|
||||
ProtocolUtils.readVarInt(buf);
|
||||
if (protocolVersion >= ProtocolConstants.MINECRAFT_1_13) {
|
||||
this.prefix = ProtocolUtils.readScoreboardTextComponent(buf, protocolVersion);
|
||||
this.suffix = ProtocolUtils.readScoreboardTextComponent(buf, protocolVersion);
|
||||
}
|
||||
if (mode == ADD) {
|
||||
this.entities = readEntities(buf);
|
||||
}
|
||||
break;
|
||||
case REMOVE: // remove
|
||||
break;
|
||||
case ADD_PLAYER: // add player
|
||||
case REMOVE_PLAYER: // remove player
|
||||
this.entities = readEntities(buf);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
|
||||
ProtocolUtils.writeString(buf, id);
|
||||
buf.writeByte(mode);
|
||||
switch (mode) {
|
||||
case ADD:
|
||||
case UPDATE:
|
||||
ProtocolUtils.writeScoreboardTextComponent(buf, protocolVersion, displayName);
|
||||
if (protocolVersion <= ProtocolConstants.MINECRAFT_1_12_2) {
|
||||
ProtocolUtils.writeScoreboardTextComponent(buf, protocolVersion, prefix);
|
||||
ProtocolUtils.writeScoreboardTextComponent(buf, protocolVersion, suffix);
|
||||
}
|
||||
buf.writeByte(flags);
|
||||
ProtocolUtils.writeString(buf, nameTagVisibility);
|
||||
if (protocolVersion >= ProtocolConstants.MINECRAFT_1_9) {
|
||||
ProtocolUtils.writeString(buf, collisionRule);
|
||||
}
|
||||
if (protocolVersion >= ProtocolConstants.MINECRAFT_1_13) {
|
||||
ProtocolUtils.writeVarInt(buf, color);
|
||||
ProtocolUtils.writeScoreboardTextComponent(buf, protocolVersion, prefix);
|
||||
ProtocolUtils.writeScoreboardTextComponent(buf, protocolVersion, suffix);
|
||||
} else {
|
||||
buf.writeByte(color);
|
||||
}
|
||||
if (mode == ADD) {
|
||||
writeEntities(buf, entities);
|
||||
}
|
||||
break;
|
||||
case REMOVE:
|
||||
break;
|
||||
case ADD_PLAYER:
|
||||
case REMOVE_PLAYER:
|
||||
writeEntities(buf, entities);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static List<String> readEntities(ByteBuf buf) {
|
||||
List<String> entities = new ArrayList<>();
|
||||
int size = ProtocolUtils.readVarInt(buf);
|
||||
for (int i = 0; i < size; i++) {
|
||||
entities.add(ProtocolUtils.readString(buf, 40));
|
||||
}
|
||||
return entities;
|
||||
}
|
||||
|
||||
private static void writeEntities(ByteBuf buf, List<String> entities) {
|
||||
ProtocolUtils.writeVarInt(buf, entities.size());
|
||||
for (String entity : entities) {
|
||||
ProtocolUtils.writeString(buf, entity);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package com.velocitypowered.proxy.protocol.util;
|
||||
|
||||
import com.velocitypowered.proxy.protocol.packet.ScoreboardObjective;
|
||||
|
||||
public class ScoreboardProtocolUtil {
|
||||
private ScoreboardProtocolUtil() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
public static ScoreboardObjective.ObjectiveMode getMode(String mode) {
|
||||
return ScoreboardObjective.ObjectiveMode.valueOf(mode.toUpperCase());
|
||||
}
|
||||
|
||||
public static ScoreboardObjective.ObjectiveMode getMode(int enumVal) {
|
||||
switch (enumVal) {
|
||||
case 0:
|
||||
return ScoreboardObjective.ObjectiveMode.INTEGER;
|
||||
case 1:
|
||||
return ScoreboardObjective.ObjectiveMode.HEARTS;
|
||||
default:
|
||||
throw new IllegalStateException("Unknown mode " + enumVal);
|
||||
}
|
||||
}
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren