From 7bd11ee3c34f094d9f90b5c29686ae48e586285d Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 14 Oct 2024 15:35:59 -0400 Subject: [PATCH] Reintroduce hack --- .../geysermc/geyser/session/GeyserSession.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java index 9c20e9909..bde1a20f8 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -963,6 +963,8 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { // Start ticking tickThread = eventLoop.scheduleAtFixedRate(this::tick, 50, 50, TimeUnit.MILLISECONDS); + this.protocol.setUseDefaultListeners(false); + TcpSession downstream; if (geyser.getBootstrap().getSocketAddress() != null) { // We're going to connect through the JVM and not through TCP @@ -997,6 +999,22 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { // We'll handle this since we have the registry data on hand downstream.setFlag(MinecraftConstants.SEND_BLANK_KNOWN_PACKS_RESPONSE, false); + // This isn't a great solution, but... we want to make sure the finish configuration packet cannot be sent + // before the KnownPacks packet. + this.downstream.getSession().addListener(new ClientListener(ProtocolState.LOGIN, loginEvent.transferring()) { + @Override + public void packetReceived(Session session, Packet packet) { + if (protocol.getInboundState() == ProtocolState.CONFIGURATION) { + if (packet instanceof ClientboundFinishConfigurationPacket) { + // Prevent + GeyserSession.this.ensureInEventLoop(() -> GeyserSession.this.sendDownstreamPacket(new ServerboundFinishConfigurationPacket())); + return; + } + } + super.packetReceived(session, packet); + } + }); + downstream.addListener(new SessionAdapter() { @Override public void packetSending(PacketSendingEvent event) {