geforkt von Mirrors/Velocity
Fix more formatting issues.
Dieser Commit ist enthalten in:
Ursprung
0100cdd244
Commit
da12008736
@ -97,7 +97,7 @@ public class BossBar implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
this.uuid = ProtocolUtils.readUuid(buf);
|
||||
this.action = ProtocolUtils.readVarInt(buf);
|
||||
switch (action) {
|
||||
@ -129,7 +129,7 @@ public class BossBar implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
if (uuid == null) {
|
||||
throw new IllegalStateException("No boss bar UUID specified");
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class Chat implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
message = ProtocolUtils.readString(buf);
|
||||
if (direction == ProtocolUtils.Direction.CLIENTBOUND) {
|
||||
type = buf.readByte();
|
||||
@ -62,7 +62,7 @@ public class Chat implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
if (message == null) {
|
||||
throw new IllegalStateException("Message is not specified");
|
||||
}
|
||||
|
@ -93,20 +93,20 @@ public class ClientSettings implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
this.locale = ProtocolUtils.readString(buf, 16);
|
||||
this.viewDistance = buf.readByte();
|
||||
this.chatVisibility = ProtocolUtils.readVarInt(buf);
|
||||
this.chatColors = buf.readBoolean();
|
||||
this.skinParts = buf.readUnsignedByte();
|
||||
|
||||
if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_9) >= 0) {
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_9) >= 0) {
|
||||
this.mainHand = ProtocolUtils.readVarInt(buf);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
if (locale == null) {
|
||||
throw new IllegalStateException("No locale specified");
|
||||
}
|
||||
@ -116,7 +116,7 @@ public class ClientSettings implements MinecraftPacket {
|
||||
buf.writeBoolean(chatColors);
|
||||
buf.writeByte(skinParts);
|
||||
|
||||
if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_9) >= 0) {
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_9) >= 0) {
|
||||
ProtocolUtils.writeVarInt(buf, mainHand);
|
||||
}
|
||||
}
|
||||
|
@ -40,12 +40,12 @@ public class Disconnect implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
reason = ProtocolUtils.readString(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
if (reason == null) {
|
||||
throw new IllegalStateException("No reason specified.");
|
||||
}
|
||||
|
@ -40,14 +40,14 @@ public class EncryptionRequest implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
this.serverId = ProtocolUtils.readString(buf, 20);
|
||||
publicKey = ProtocolUtils.readByteArray(buf, 256);
|
||||
verifyToken = ProtocolUtils.readByteArray(buf, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
ProtocolUtils.writeString(buf, this.serverId);
|
||||
ProtocolUtils.writeByteArray(buf, publicKey);
|
||||
ProtocolUtils.writeByteArray(buf, verifyToken);
|
||||
|
@ -39,13 +39,13 @@ public class EncryptionResponse implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
this.sharedSecret = ProtocolUtils.readByteArray(buf, 256);
|
||||
this.verifyToken = ProtocolUtils.readByteArray(buf, 128);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
ProtocolUtils.writeByteArray(buf, sharedSecret);
|
||||
ProtocolUtils.writeByteArray(buf, verifyToken);
|
||||
}
|
||||
|
@ -38,12 +38,12 @@ public class HeaderAndFooter implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
throw new UnsupportedOperationException("Decode is not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
writeString(buf, header);
|
||||
writeString(buf, footer);
|
||||
}
|
||||
|
@ -90,10 +90,10 @@ public class JoinGame implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
this.entityId = buf.readInt();
|
||||
this.gamemode = buf.readUnsignedByte();
|
||||
if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_9_1) >= 0) {
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_9_1) >= 0) {
|
||||
this.dimension = buf.readInt();
|
||||
} else {
|
||||
this.dimension = buf.readByte();
|
||||
@ -105,10 +105,10 @@ public class JoinGame implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
buf.writeInt(entityId);
|
||||
buf.writeByte(gamemode);
|
||||
if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_9_1) >= 0) {
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_9_1) >= 0) {
|
||||
buf.writeInt(dimension);
|
||||
} else {
|
||||
buf.writeByte(dimension);
|
||||
|
@ -26,8 +26,8 @@ public class KeepAlive implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_12_2) >= 0) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_12_2) >= 0) {
|
||||
randomId = buf.readLong();
|
||||
} else {
|
||||
randomId = ProtocolUtils.readVarInt(buf);
|
||||
@ -35,8 +35,8 @@ public class KeepAlive implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_12_2) >= 0) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_12_2) >= 0) {
|
||||
buf.writeLong(randomId);
|
||||
} else {
|
||||
ProtocolUtils.writeVarInt(buf, (int) randomId);
|
||||
|
@ -49,7 +49,7 @@ public class LoginPluginMessage implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
this.id = ProtocolUtils.readVarInt(buf);
|
||||
this.channel = ProtocolUtils.readString(buf);
|
||||
if (buf.isReadable()) {
|
||||
@ -60,7 +60,7 @@ public class LoginPluginMessage implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
ProtocolUtils.writeVarInt(buf, id);
|
||||
if (channel == null) {
|
||||
throw new IllegalStateException("Channel is not specified!");
|
||||
|
@ -47,7 +47,7 @@ public class LoginPluginResponse implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
this.id = ProtocolUtils.readVarInt(buf);
|
||||
this.success = buf.readBoolean();
|
||||
if (buf.isReadable()) {
|
||||
@ -58,7 +58,7 @@ public class LoginPluginResponse implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
ProtocolUtils.writeVarInt(buf, id);
|
||||
buf.writeBoolean(success);
|
||||
buf.writeBytes(data);
|
||||
|
@ -42,7 +42,7 @@ public class PlayerListItem implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
action = ProtocolUtils.readVarInt(buf);
|
||||
int length = ProtocolUtils.readVarInt(buf);
|
||||
|
||||
@ -84,7 +84,7 @@ public class PlayerListItem implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
ProtocolUtils.writeVarInt(buf, action);
|
||||
ProtocolUtils.writeVarInt(buf, items.size());
|
||||
for (Item item : items) {
|
||||
|
@ -43,14 +43,14 @@ public class PluginMessage implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
this.channel = ProtocolUtils.readString(buf);
|
||||
this.data = new byte[buf.readableBytes()];
|
||||
buf.readBytes(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
if (channel == null) {
|
||||
throw new IllegalStateException("Channel is not specified.");
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public class Respawn implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
this.dimension = buf.readInt();
|
||||
this.difficulty = buf.readUnsignedByte();
|
||||
this.gamemode = buf.readUnsignedByte();
|
||||
@ -74,7 +74,7 @@ public class Respawn implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
buf.writeInt(dimension);
|
||||
buf.writeByte(difficulty);
|
||||
buf.writeByte(gamemode);
|
||||
|
@ -34,12 +34,12 @@ public class ServerLogin implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
username = ProtocolUtils.readString(buf, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
if (username == null) {
|
||||
throw new IllegalStateException("No username found!");
|
||||
}
|
||||
|
@ -44,13 +44,13 @@ public class ServerLoginSuccess implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
uuid = UUID.fromString(ProtocolUtils.readString(buf, 36));
|
||||
username = ProtocolUtils.readString(buf, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
if (uuid == null) {
|
||||
throw new IllegalStateException("No UUID specified!");
|
||||
}
|
||||
|
@ -33,12 +33,12 @@ public class SetCompression implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
this.threshold = ProtocolUtils.readVarInt(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
ProtocolUtils.writeVarInt(buf, threshold);
|
||||
}
|
||||
|
||||
|
@ -11,12 +11,12 @@ public class StatusPing implements MinecraftPacket {
|
||||
private long randomId;
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
randomId = buf.readLong();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
buf.writeLong(randomId);
|
||||
}
|
||||
|
||||
|
@ -15,12 +15,12 @@ public class StatusRequest implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
// There is no additional data to decode.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
// There is no data to decode.
|
||||
}
|
||||
|
||||
|
@ -33,12 +33,12 @@ public class StatusResponse implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
status = ProtocolUtils.readString(buf, Short.MAX_VALUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
if (status == null) {
|
||||
throw new IllegalStateException("Status is not specified");
|
||||
}
|
||||
|
@ -60,9 +60,9 @@ public class TabCompleteRequest implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
this.command = ProtocolUtils.readString(buf);
|
||||
if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_9) >= 0) {
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_9) >= 0) {
|
||||
this.assumeCommand = buf.readBoolean();
|
||||
}
|
||||
this.hasPosition = buf.readBoolean();
|
||||
@ -72,12 +72,12 @@ public class TabCompleteRequest implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
if (command == null) {
|
||||
throw new IllegalStateException("Command is not specified");
|
||||
}
|
||||
ProtocolUtils.writeString(buf, command);
|
||||
if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_9) >= 0) {
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_9) >= 0) {
|
||||
buf.writeBoolean(assumeCommand);
|
||||
}
|
||||
buf.writeBoolean(hasPosition);
|
||||
|
@ -24,7 +24,7 @@ public class TabCompleteResponse implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
int offersAvailable = ProtocolUtils.readVarInt(buf);
|
||||
for (int i = 0; i < offersAvailable; i++) {
|
||||
offers.add(ProtocolUtils.readString(buf));
|
||||
@ -32,7 +32,7 @@ public class TabCompleteResponse implements MinecraftPacket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
ProtocolUtils.writeVarInt(buf, offers.size());
|
||||
for (String offer : offers) {
|
||||
ProtocolUtils.writeString(buf, offer);
|
||||
|
@ -26,14 +26,14 @@ public class TitlePacket implements MinecraftPacket {
|
||||
private int fadeOut;
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
throw new UnsupportedOperationException(); // encode only
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
|
||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
ProtocolUtils.writeVarInt(buf, action);
|
||||
if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_11) >= 0) {
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_11) >= 0) {
|
||||
// 1.11+ shifted the action enum by 1 to handle the action bar
|
||||
switch (action) {
|
||||
case SET_TITLE:
|
||||
@ -118,23 +118,23 @@ public class TitlePacket implements MinecraftPacket {
|
||||
this.fadeOut = fadeOut;
|
||||
}
|
||||
|
||||
public static TitlePacket hideForProtocolVersion(ProtocolVersion protocolVersion) {
|
||||
public static TitlePacket hideForProtocolVersion(ProtocolVersion version) {
|
||||
TitlePacket packet = new TitlePacket();
|
||||
packet.setAction(protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_11) >= 0 ? TitlePacket.HIDE
|
||||
packet.setAction(version.compareTo(ProtocolVersion.MINECRAFT_1_11) >= 0 ? TitlePacket.HIDE
|
||||
: TitlePacket.HIDE_OLD);
|
||||
return packet;
|
||||
}
|
||||
|
||||
public static TitlePacket resetForProtocolVersion(ProtocolVersion protocolVersion) {
|
||||
public static TitlePacket resetForProtocolVersion(ProtocolVersion version) {
|
||||
TitlePacket packet = new TitlePacket();
|
||||
packet.setAction(protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_11) >= 0 ? TitlePacket.RESET
|
||||
packet.setAction(version.compareTo(ProtocolVersion.MINECRAFT_1_11) >= 0 ? TitlePacket.RESET
|
||||
: TitlePacket.RESET_OLD);
|
||||
return packet;
|
||||
}
|
||||
|
||||
public static TitlePacket timesForProtocolVersion(ProtocolVersion protocolVersion) {
|
||||
public static TitlePacket timesForProtocolVersion(ProtocolVersion version) {
|
||||
TitlePacket packet = new TitlePacket();
|
||||
packet.setAction(protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_11) >= 0 ? TitlePacket.SET_TIMES
|
||||
packet.setAction(version.compareTo(ProtocolVersion.MINECRAFT_1_11) >= 0 ? TitlePacket.SET_TIMES
|
||||
: TitlePacket.SET_TIMES_OLD);
|
||||
return packet;
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren