From 6b26daa2819891a625cba965ff165334c0f47304 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sat, 22 Aug 2020 15:52:29 -0400 Subject: [PATCH] Small cleanup in closeWith --- .../proxy/connection/MinecraftConnection.java | 6 +++--- 1 file changed, 3 insertions(+), 3 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 d9210e636..2361d6cb9 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java @@ -225,13 +225,13 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { public void closeWith(Object msg) { if (channel.isActive()) { boolean is1Point8 = this.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_8) >= 0; - boolean isLegacyPing = this.getState() == StateRegistry.HANDSHAKE + boolean isLegacyOrPing = this.getState() == StateRegistry.HANDSHAKE || this.getState() == StateRegistry.STATUS; - if (channel.eventLoop().inEventLoop() && (is1Point8 || isLegacyPing)) { + if (channel.eventLoop().inEventLoop() && (is1Point8 || isLegacyOrPing)) { knownDisconnect = true; channel.writeAndFlush(msg).addListener(ChannelFutureListener.CLOSE); } else { - // 1.7.x versions have a race condition with switching protocol versions, so just explicitly + // 1.7.x versions have a race condition with switching protocol states, so just explicitly // close the connection after a short while. this.setAutoReading(false); channel.eventLoop().schedule(() -> {