Bridge packets both ways.

This commit is contained in:
md_5 2013-03-09 14:27:24 +11:00
parent f0a19e0f45
commit f0766ebcfb
3 changed files with 4 additions and 2 deletions

View File

@ -98,6 +98,7 @@ public class ServerConnector extends PacketHandler
// Add to new server // Add to new server
target.addPlayer( user ); target.addPlayer( user );
user.setServer( server );
ch.pipeline().get( HandlerBoss.class ).setHandler( new DownstreamBridge( bungee, user ) ); ch.pipeline().get( HandlerBoss.class ).setHandler( new DownstreamBridge( bungee, user ) );
} }

View File

@ -14,6 +14,7 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Queue; import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue;
import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.Synchronized; import lombok.Synchronized;
@ -33,13 +34,14 @@ public final class UserConnection implements ProxiedPlayer
public final Packet2Handshake handshake; public final Packet2Handshake handshake;
private final ProxyServer bungee; private final ProxyServer bungee;
public final Channel ch; public final Channel ch;
final Packet1Login forgeLogin; final Packet1Login forgeLogin;
final List<PacketFAPluginMessage> loginMessages; final List<PacketFAPluginMessage> loginMessages;
public Queue<DefinedPacket> packetQueue = new ConcurrentLinkedQueue<>(); public Queue<DefinedPacket> packetQueue = new ConcurrentLinkedQueue<>();
@Getter @Getter
private final PendingConnection pendingConnection; private final PendingConnection pendingConnection;
@Getter @Getter
@Setter(AccessLevel.PACKAGE)
private ServerConnection server; private ServerConnection server;
// reconnect stuff // reconnect stuff
public int clientEntityId; public int clientEntityId;

View File

@ -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.ChatEvent;
import net.md_5.bungee.api.event.PluginMessageEvent; import net.md_5.bungee.api.event.PluginMessageEvent;
import net.md_5.bungee.packet.Packet0KeepAlive; 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.Packet3Chat;
import net.md_5.bungee.packet.PacketFAPluginMessage; import net.md_5.bungee.packet.PacketFAPluginMessage;
import net.md_5.bungee.packet.PacketHandler; import net.md_5.bungee.packet.PacketHandler;