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