diff --git a/src/main/java/net/elytrium/fastmotd/injection/HandshakeSessionHandlerHook.java b/src/main/java/net/elytrium/fastmotd/injection/HandshakeSessionHandlerHook.java index a7c5617..1bf76ea 100644 --- a/src/main/java/net/elytrium/fastmotd/injection/HandshakeSessionHandlerHook.java +++ b/src/main/java/net/elytrium/fastmotd/injection/HandshakeSessionHandlerHook.java @@ -67,11 +67,19 @@ public boolean handle(LegacyHandshakePacket packet) { @Override public boolean handle(HandshakePacket handshake) { - if (handshake.getProtocolVersion() == null || handshake.getProtocolVersion() == ProtocolVersion.UNKNOWN) { - handshake.setProtocolVersion(ProtocolVersion.MAXIMUM_VERSION); - } - if (handshake.getNextStatus() == StateRegistry.STATUS_ID) { + if (handshake.getProtocolVersion() == null || handshake.getProtocolVersion() == ProtocolVersion.UNKNOWN) { + handshake.setProtocolVersion(ProtocolVersion.MAXIMUM_VERSION); + + if (Settings.IMP.MAIN.LOG_PINGS) { + this.plugin.getLogger().info( + "Unknown protocol version detected from {}, replaced with version {}", + this.connection.getRemoteAddress(), + ProtocolVersion.MAXIMUM_VERSION + ); + } + } + this.protocolVersion = handshake.getProtocolVersion(); this.serverAddress = handshake.getServerAddress() + ":" + handshake.getPort(); this.channel.pipeline().remove(Connections.FRAME_ENCODER);