2019-04-23 10:09:26 +02:00
|
|
|
From 0bcddf3f2a54189e017bb728c4486f65dd691a8b Mon Sep 17 00:00:00 2001
|
2017-07-17 21:26:31 +02:00
|
|
|
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
|
2019-04-23 10:09:26 +02:00
|
|
|
index 7166d061..b5b9ec70 100644
|
2017-07-17 21:26:31 +02:00
|
|
|
--- a/proxy/src/main/java/net/md_5/bungee/forge/ForgeServerHandler.java
|
|
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/forge/ForgeServerHandler.java
|
2019-04-23 10:09:26 +02:00
|
|
|
@@ -50,7 +50,7 @@ public class ForgeServerHandler
|
2017-07-17 21:26:31 +02:00
|
|
|
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 )
|
|
|
|
{
|
|
|
|
--
|
2019-04-23 10:09:26 +02:00
|
|
|
2.21.0
|
2017-07-17 21:26:31 +02:00
|
|
|
|