Waterfall/BungeeCord-Patches/0034-Fix-some-forge-plugin-message-packets-not-being-forw.patch
_tomcraft 85c0a35f0b
Updated Upstream (BungeeCord) (#695)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

BungeeCord Changes:
6613aaea Add test fix for library classes being visible to non-dependent plugins
53ce6b93 #3200: Fix protocol for 21w40a
d8e29384 #2466: Use switch in "BungeeCord" plugin message handling
5cf869df #3198: Remove terminally deprecated SecurityManager
f26f7d88 Add optional 1.18 (21w40a) snapshot protocol support
2021-10-09 10:43:12 +01:00

60 lines
2.8 KiB
Diff

From 71d876da0ca5d9b2c2a17f04dad395c80d22fcdc Mon Sep 17 00:00:00 2001
From: Daniel Naylor <git@drnaylor.co.uk>
Date: Mon, 17 Jul 2017 20:24:17 +0100
Subject: [PATCH] Fix some forge plugin message packets not being forwarded
correctly
This fixes #155, see SpongePowered/SpongeForge#1507
diff --git a/proxy/src/main/java/net/md_5/bungee/forge/ForgeClientHandshakeState.java b/proxy/src/main/java/net/md_5/bungee/forge/ForgeClientHandshakeState.java
index 52429265..5e02f8c8 100644
--- a/proxy/src/main/java/net/md_5/bungee/forge/ForgeClientHandshakeState.java
+++ b/proxy/src/main/java/net/md_5/bungee/forge/ForgeClientHandshakeState.java
@@ -171,7 +171,8 @@ enum ForgeClientHandshakeState implements IForgeClientPacketHandler<ForgeClientH
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
{
// Ack.
- if ( message.getData()[0] == -1 )
+ if (( message.getTag().equals( ForgeConstants.FML_HANDSHAKE_TAG ) && message.getData()[0] == -1 )
+ || message.getTag().equals( ForgeConstants.FORGE_REGISTER ))
{
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
con.unsafe().sendPacket( message );
@@ -187,7 +188,7 @@ enum ForgeClientHandshakeState implements IForgeClientPacketHandler<ForgeClientH
}
},
/**
- * Handshake has been completed. Ignores any future handshake packets.
+ * Handshake has been completed. Ignores any future handshake packets, but not any FORGE packets.
*/
DONE
{
@@ -196,6 +197,11 @@ enum ForgeClientHandshakeState implements IForgeClientPacketHandler<ForgeClientH
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
{
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
+ if ( message.getTag().equals( ForgeConstants.FORGE_REGISTER ))
+ {
+ con.unsafe().sendPacket( message );
+ }
+
return this;
}
diff --git a/proxy/src/main/java/net/md_5/bungee/forge/ForgeServerHandler.java b/proxy/src/main/java/net/md_5/bungee/forge/ForgeServerHandler.java
index 77d18e6d..d254b84e 100644
--- a/proxy/src/main/java/net/md_5/bungee/forge/ForgeServerHandler.java
+++ b/proxy/src/main/java/net/md_5/bungee/forge/ForgeServerHandler.java
@@ -50,7 +50,7 @@ public class ForgeServerHandler
ForgeServerHandshakeState prevState = state;
packetQueue.add( message );
state = state.send( message, con );
- if ( state != prevState ) // send packets
+ if ( state == ForgeServerHandshakeState.DONE || state != prevState ) // send packets
{
synchronized ( packetQueue )
{
--
2.30.1 (Apple Git-130)