From 85d88d59d30ad53f8e3029379da0e96e886dc5fb Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Fri, 3 Jul 2020 19:16:55 -0400 Subject: [PATCH] Fix pinging being "delayed" on 1.7 --- .../proxy/connection/MinecraftConnection.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 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 8966e8bc4..c29ec7274 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java @@ -209,8 +209,10 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { */ public void closeWith(Object msg) { if (channel.isActive()) { - if (channel.eventLoop().inEventLoop() - && this.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0) { + boolean is1Point8 = this.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0; + boolean isLegacyPing = this.getState() == StateRegistry.HANDSHAKE + || this.getState() == StateRegistry.STATUS; + if (channel.eventLoop().inEventLoop() && (is1Point8 || isLegacyPing)) { knownDisconnect = true; channel.writeAndFlush(msg).addListener(ChannelFutureListener.CLOSE); } else {