From b5aecd5dcc319601bc3444ec0cd264b7f38b0aaf Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 8 Jun 2013 12:35:50 +1000 Subject: [PATCH] Stab at fixing forge and wecui support when combined. F**** I hate mods. --- .../main/java/net/md_5/bungee/ServerConnector.java | 6 +++++- .../net/md_5/bungee/connection/InitialHandler.java | 11 ++++++++++- .../net/md_5/bungee/connection/UpstreamBridge.java | 2 +- 3 files changed, 16 insertions(+), 3 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 359c3b23..001839b0 100644 --- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java +++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java @@ -77,7 +77,7 @@ public class ServerConnector extends PacketHandler ByteArrayDataOutput out = ByteStreams.newDataOutput(); out.writeUTF( "Login" ); - out.writeUTF( user.getAddress().getAddress().getHostAddress() ); + out.writeUTF( user.getAddress().getHostString() ); out.writeInt( user.getAddress().getPort() ); channel.write( new PacketFAPluginMessage( "BungeeCord", out.toByteArray() ) ); @@ -115,6 +115,10 @@ public class ServerConnector extends PacketHandler } } + for ( PacketFAPluginMessage message : user.getPendingConnection().getRegisterMessages() ) + { + ch.write( message ); + } if ( !sentMessages ) { for ( PacketFAPluginMessage message : user.getPendingConnection().getLoginMessages() ) diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java index 728dc1ff..e888c9b1 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java @@ -63,6 +63,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection private PacketFDEncryptionRequest request; @Getter private List loginMessages = new ArrayList<>(); + @Getter + private List registerMessages = new ArrayList<>(); private State thisState = State.HANDSHAKE; private SecretKey sharedKey; private final Unsafe unsafe = new Unsafe() @@ -95,7 +97,14 @@ public class InitialHandler extends PacketHandler implements PendingConnection @Override public void handle(PacketFAPluginMessage pluginMessage) throws Exception { - loginMessages.add( pluginMessage ); + // TODO: Unregister? + if ( pluginMessage.getTag().equals( "REGISTER" ) ) + { + registerMessages.add( pluginMessage ); + } else + { + loginMessages.add( pluginMessage ); + } } @Override 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 67ff66dd..168034b0 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 @@ -125,7 +125,7 @@ public class UpstreamBridge extends PacketHandler // TODO: Unregister as well? if ( pluginMessage.getTag().equals( "REGISTER" ) ) { - con.getPendingConnection().getLoginMessages().add( pluginMessage ); + con.getPendingConnection().getRegisterMessages().add( pluginMessage ); } }