From 8f570075f1e10bb17b3ac6b207fce6e70c4d262e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20G=2E=20J=C3=B8rgensen?= Date: Mon, 1 Apr 2024 20:51:45 +0200 Subject: [PATCH] Fix for #22 Based on this comment: https://github.com/Elytrium/FastMOTD/issues/22#issuecomment-1712924166 Use ProtocolVersion.MAXIMUM_VERSION to align with Velocity: https://github.com/PaperMC/velocity/commit/12a05f6d751ce0f8447a6ae5832c21dc494ed4fd --- .../fastmotd/injection/HandshakeSessionHandlerHook.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/net/elytrium/fastmotd/injection/HandshakeSessionHandlerHook.java b/src/main/java/net/elytrium/fastmotd/injection/HandshakeSessionHandlerHook.java index 56223ad..a7c5617 100644 --- a/src/main/java/net/elytrium/fastmotd/injection/HandshakeSessionHandlerHook.java +++ b/src/main/java/net/elytrium/fastmotd/injection/HandshakeSessionHandlerHook.java @@ -67,6 +67,10 @@ 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) { this.protocolVersion = handshake.getProtocolVersion(); this.serverAddress = handshake.getServerAddress() + ":" + handshake.getPort();