From 0684e08f677bf9c40fe87c02835665ac8ea979ac Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Tue, 23 Jun 2020 08:32:47 -0400 Subject: [PATCH] Really suppress the initial connection stuff --- .../proxy/connection/MinecraftConnection.java | 4 +++- .../proxy/connection/client/InitialInboundConnection.java | 7 ++++++- 2 files changed, 9 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 189e73eb5..84649904a 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/MinecraftConnection.java @@ -16,6 +16,7 @@ import com.velocitypowered.natives.encryption.VelocityCipher; import com.velocitypowered.natives.encryption.VelocityCipherFactory; import com.velocitypowered.natives.util.Natives; import com.velocitypowered.proxy.VelocityServer; +import com.velocitypowered.proxy.connection.client.InitialInboundConnection; import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.protocol.netty.MinecraftCipherDecoder; @@ -90,7 +91,8 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter { sessionHandler.disconnected(); } - if (association != null && !knownDisconnect) { + if (association != null && !knownDisconnect + && !(association instanceof InitialInboundConnection)) { logger.info("{} has disconnected", association); } } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/InitialInboundConnection.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/InitialInboundConnection.java index 1a663edf7..bab4bd8de 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/InitialInboundConnection.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/InitialInboundConnection.java @@ -13,7 +13,8 @@ import net.kyori.text.serializer.legacy.LegacyComponentSerializer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -class InitialInboundConnection implements InboundConnection, MinecraftConnectionAssociation { +public final class InitialInboundConnection implements InboundConnection, + MinecraftConnectionAssociation { private static final Logger logger = LogManager.getLogger(InitialInboundConnection.class); @@ -53,6 +54,10 @@ class InitialInboundConnection implements InboundConnection, MinecraftConnection return "[initial connection] " + connection.getRemoteAddress().toString(); } + /** + * Disconnects the connection from the server. + * @param reason the reason for disconnecting + */ public void disconnect(Component reason) { logger.info("{} has disconnected: {}", this, LegacyComponentSerializer.legacy().serialize(reason));