From 399bc2325f36165e1abc5470358ff3f9faaf3344 Mon Sep 17 00:00:00 2001 From: "Pantera (Mad_Daniel)" <89838384+Pantera07@users.noreply.github.com> Date: Tue, 30 Apr 2024 15:13:08 +0900 Subject: [PATCH 1/4] Add version information for 1.20.6 (#1310) https://www.minecraft.net/en-us/article/minecraft-java-edition-1-20-6 --- .../java/com/velocitypowered/api/network/ProtocolVersion.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java b/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java index 9627b0e9a..8723d8884 100644 --- a/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java +++ b/api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java @@ -86,7 +86,7 @@ public enum ProtocolVersion implements Ordered { MINECRAFT_1_20(763, "1.20", "1.20.1"), MINECRAFT_1_20_2(764, "1.20.2"), MINECRAFT_1_20_3(765, "1.20.3", "1.20.4"), - MINECRAFT_1_20_5(766, "1.20.5"); + MINECRAFT_1_20_5(766, "1.20.5", "1.20.6"); private static final int SNAPSHOT_BIT = 30; From 5cdcf86cf9fd7bd25c3c140435b9c63bc8f830fd Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Wed, 1 May 2024 17:22:18 +0100 Subject: [PATCH 2/4] Properly pass connection exceptions to the logger --- .../proxy/connection/MinecraftConnection.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java index 53d0a2364..b1c91ebdb 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java @@ -195,8 +195,9 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { boolean isQuietDecoderException = cause instanceof QuietDecoderException; boolean willLog = !isQuietDecoderException && !frontlineHandler; if (willLog) { - logger.error("{}: exception encountered in {}", association, activeSessionHandler, - cause); + logger.atError().withThrowable(cause) + .log("{}: exception encountered in {}", association, + activeSessionHandler); } else { knownDisconnect = true; } @@ -226,7 +227,6 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { * Writes and immediately flushes a message to the connection. * * @param msg the message to write - * * @return A {@link ChannelFuture} that will complete when packet is successfully sent */ @Nullable @@ -370,12 +370,12 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { this.state = state; // If the connection is LEGACY (<1.6), the decoder and encoder are not set. final MinecraftEncoder minecraftEncoder = this.channel.pipeline() - .get(MinecraftEncoder.class); + .get(MinecraftEncoder.class); if (minecraftEncoder != null) { minecraftEncoder.setState(state); } final MinecraftDecoder minecraftDecoder = this.channel.pipeline() - .get(MinecraftDecoder.class); + .get(MinecraftDecoder.class); if (minecraftDecoder != null) { minecraftDecoder.setState(state); } @@ -395,8 +395,8 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { public void addPlayPacketQueueHandler() { if (this.channel.pipeline().get(Connections.PLAY_PACKET_QUEUE) == null) { this.channel.pipeline().addAfter(Connections.MINECRAFT_ENCODER, Connections.PLAY_PACKET_QUEUE, - new PlayPacketQueueHandler(this.protocolVersion, - channel.pipeline().get(MinecraftEncoder.class).getDirection())); + new PlayPacketQueueHandler(this.protocolVersion, + channel.pipeline().get(MinecraftEncoder.class).getDirection())); } } From 368d1a7c1250b4138f683e64ebb6aadfe7a4b1b3 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Wed, 1 May 2024 18:03:37 +0100 Subject: [PATCH 3/4] Do not send empty upsert player info packets There is no harm in this, but seemingly, some common mod blows up on this, and, well, why eat buffer? --- .../com/velocitypowered/proxy/tablist/VelocityTabList.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabList.java b/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabList.java index e18881b45..d6b4143ce 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabList.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/tablist/VelocityTabList.java @@ -166,7 +166,9 @@ public class VelocityTabList implements InternalTabList { return entry; }); - this.connection.write(new UpsertPlayerInfoPacket(actions, List.of(playerInfoEntry))); + if (!actions.isEmpty()) { + this.connection.write(new UpsertPlayerInfoPacket(actions, List.of(playerInfoEntry))); + } } @Override From 1228f147423d14a6e0b0c940259aa59da90797b1 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Fri, 3 May 2024 19:20:12 +0100 Subject: [PATCH 4/4] Hotfix cancelling unsigned 1.20.6 commands --- .../protocol/packet/chat/session/SessionCommandHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/session/SessionCommandHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/session/SessionCommandHandler.java index 5048294ca..6984970b3 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/session/SessionCommandHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/session/SessionCommandHandler.java @@ -55,7 +55,7 @@ public class SessionCommandHandler implements CommandHandler