diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/BossBar.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/BossBar.java index aa2942a54..e1d8d9453 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/BossBar.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/BossBar.java @@ -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"); } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Chat.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Chat.java index 330eee6cc..92723d456 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Chat.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Chat.java @@ -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"); } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ClientSettings.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ClientSettings.java index 523fa29a6..80db8e997 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ClientSettings.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ClientSettings.java @@ -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); } } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Disconnect.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Disconnect.java index 4c6e30ced..f7adb2b28 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Disconnect.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Disconnect.java @@ -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."); } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/EncryptionRequest.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/EncryptionRequest.java index dce6da81e..a238226a2 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/EncryptionRequest.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/EncryptionRequest.java @@ -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); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/EncryptionResponse.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/EncryptionResponse.java index 5fca09560..7d64ca4ca 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/EncryptionResponse.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/EncryptionResponse.java @@ -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); } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/HeaderAndFooter.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/HeaderAndFooter.java index c9a7b3006..cd1fa56d3 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/HeaderAndFooter.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/HeaderAndFooter.java @@ -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); } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/JoinGame.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/JoinGame.java index f37a9110a..bae132f5c 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/JoinGame.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/JoinGame.java @@ -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); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/KeepAlive.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/KeepAlive.java index 69e161562..e4b581617 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/KeepAlive.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/KeepAlive.java @@ -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); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LoginPluginMessage.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LoginPluginMessage.java index 25e67e9d8..26fb8cb70 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LoginPluginMessage.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LoginPluginMessage.java @@ -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!"); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LoginPluginResponse.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LoginPluginResponse.java index c37b6cddf..159482cd8 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LoginPluginResponse.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/LoginPluginResponse.java @@ -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); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/PlayerListItem.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/PlayerListItem.java index 1b8ee3769..cd392e4cb 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/PlayerListItem.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/PlayerListItem.java @@ -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) { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/PluginMessage.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/PluginMessage.java index 26fea4d39..70f4c4334 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/PluginMessage.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/PluginMessage.java @@ -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."); } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Respawn.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Respawn.java index 3cab31bcd..89a607170 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Respawn.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Respawn.java @@ -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); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLogin.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLogin.java index 18576c4a1..8a965c23d 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLogin.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLogin.java @@ -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!"); } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLoginSuccess.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLoginSuccess.java index cb297e5f7..0d068bd7a 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLoginSuccess.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/ServerLoginSuccess.java @@ -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!"); } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/SetCompression.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/SetCompression.java index 003951433..50996cc1c 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/SetCompression.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/SetCompression.java @@ -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); } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusPing.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusPing.java index c2ac1815c..7d61e6996 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusPing.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusPing.java @@ -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); } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusRequest.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusRequest.java index ddd1eece8..7d1b9bc57 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusRequest.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusRequest.java @@ -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. } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusResponse.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusResponse.java index f49b4b32c..84493513d 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusResponse.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/StatusResponse.java @@ -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"); } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TabCompleteRequest.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TabCompleteRequest.java index 833b559af..e0ce9a7a5 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TabCompleteRequest.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TabCompleteRequest.java @@ -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); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TabCompleteResponse.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TabCompleteResponse.java index eae1c8d11..3b208bab0 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TabCompleteResponse.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TabCompleteResponse.java @@ -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); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TitlePacket.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TitlePacket.java index 2aa7baa38..085936ae8 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TitlePacket.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/TitlePacket.java @@ -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; }