From f0766ebcfbd852ca118a8fc57a0efa1e61e8e3bd Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 9 Mar 2013 14:27:24 +1100 Subject: [PATCH] Bridge packets both ways. --- proxy/src/main/java/net/md_5/bungee/ServerConnector.java | 1 + proxy/src/main/java/net/md_5/bungee/UserConnection.java | 4 +++- .../main/java/net/md_5/bungee/connection/UpstreamBridge.java | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java index 3bdab4b9..5b47bf0b 100644 --- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java +++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java @@ -98,6 +98,7 @@ public class ServerConnector extends PacketHandler // Add to new server target.addPlayer( user ); + user.setServer( server ); ch.pipeline().get( HandlerBoss.class ).setHandler( new DownstreamBridge( bungee, user ) ); } diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java index 36cf93e3..b189387e 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -14,6 +14,7 @@ import java.util.Collections; import java.util.List; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; +import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import lombok.Synchronized; @@ -33,13 +34,14 @@ public final class UserConnection implements ProxiedPlayer public final Packet2Handshake handshake; private final ProxyServer bungee; - public final Channel ch; + public final Channel ch; final Packet1Login forgeLogin; final List loginMessages; public Queue packetQueue = new ConcurrentLinkedQueue<>(); @Getter private final PendingConnection pendingConnection; @Getter + @Setter(AccessLevel.PACKAGE) private ServerConnection server; // reconnect stuff public int clientEntityId; diff --git a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java index 6f2dd6ad..6a807df7 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java @@ -9,7 +9,6 @@ import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.event.ChatEvent; import net.md_5.bungee.api.event.PluginMessageEvent; import net.md_5.bungee.packet.Packet0KeepAlive; -import net.md_5.bungee.packet.Packet1Login; import net.md_5.bungee.packet.Packet3Chat; import net.md_5.bungee.packet.PacketFAPluginMessage; import net.md_5.bungee.packet.PacketHandler;