Avoid adding NetworkManager twice

The removal of `ServerConnection.this.h.add(networkmanager);` got
lost in the 1.13 update, causing network managers to be registered
twice.

Fixes "handleDisconnection() called twice" warning spam in console.
This commit is contained in:
Minecrell 2018-07-19 20:14:27 +02:00
parent 9a1643dab4
commit 391324437a

View file

@ -6,7 +6,7 @@ Subject: [PATCH] Avoid blocking on Network Manager creation
Per Paper issue 294
diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java
index be8d07f41..ad49673c1 100644
index be8d07f41..9808561eb 100644
--- a/src/main/java/net/minecraft/server/ServerConnection.java
+++ b/src/main/java/net/minecraft/server/ServerConnection.java
@@ -0,0 +0,0 @@ public class ServerConnection {
@ -26,9 +26,10 @@ index be8d07f41..ad49673c1 100644
public ServerConnection(MinecraftServer minecraftserver) {
this.e = minecraftserver;
@@ -0,0 +0,0 @@ public class ServerConnection {
channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(ServerConnection.this)).addLast("splitter", new PacketSplitter()).addLast("decoder", new PacketDecoder(EnumProtocolDirection.SERVERBOUND)).addLast("prepender", new PacketPrepender()).addLast("encoder", new PacketEncoder(EnumProtocolDirection.CLIENTBOUND));
NetworkManager networkmanager = new NetworkManager(EnumProtocolDirection.SERVERBOUND);
ServerConnection.this.g.add(networkmanager);
- ServerConnection.this.g.add(networkmanager);
+ pending.add(networkmanager); // Paper
channel.pipeline().addLast("packet_handler", networkmanager);
networkmanager.setPacketListener(new HandshakeListener(ServerConnection.this.e, networkmanager));