From f44cf6c8e99e41911a195265824da65c67eed698 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 27 Apr 2013 12:27:40 +1000 Subject: [PATCH] Move some bootstrapping to the connected method, #267 --- .../java/net/md_5/bungee/ServerConnector.java | 9 --------- .../md_5/bungee/connection/UpstreamBridge.java | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 9 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 6d2a7730..7242281f 100644 --- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java +++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java @@ -86,8 +86,6 @@ public class ServerConnector extends PacketHandler { if ( user.getServer() == null ) { - BungeeCord.getInstance().connections.put( user.getName(), user ); - bungee.getTabListHandler().onConnect( user ); // Once again, first connection user.clientEntityId = login.entityId; user.serverEntityId = login.entityId; @@ -101,13 +99,6 @@ public class ServerConnector extends PacketHandler login.unused, (byte) user.getPendingConnection().getListener().getTabListSize() ); user.ch.write( modLogin ); - ch.write( BungeeCord.getInstance().registerChannels() ); - - TexturePackInfo texture = user.getPendingConnection().getListener().getTexturePack(); - if ( texture != null ) - { - ch.write( new PacketFAPluginMessage( "MC|TPack", ( texture.getUrl() + "\00" + texture.getSize() ).getBytes() ) ); - } } else { bungee.getTabListHandler().onServerChange( user ); 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 52bc60b8..a74b3788 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 @@ -7,6 +7,7 @@ import net.md_5.bungee.EntityMap; import net.md_5.bungee.UserConnection; import net.md_5.bungee.Util; import net.md_5.bungee.api.ProxyServer; +import net.md_5.bungee.api.config.TexturePackInfo; import net.md_5.bungee.api.event.ChatEvent; import net.md_5.bungee.api.event.PlayerDisconnectEvent; import net.md_5.bungee.api.event.PluginMessageEvent; @@ -29,6 +30,20 @@ public class UpstreamBridge extends PacketHandler con.disconnect( Util.exception( t ) ); } + @Override + public void connected(Channel channel) throws Exception + { + BungeeCord.getInstance().connections.put( con.getName(), con ); + bungee.getTabListHandler().onConnect( con ); + con.ch.write( BungeeCord.getInstance().registerChannels() ); + + TexturePackInfo texture = con.getPendingConnection().getListener().getTexturePack(); + if ( texture != null ) + { + con.ch.write( new PacketFAPluginMessage( "MC|TPack", ( texture.getUrl() + "\00" + texture.getSize() ).getBytes() ) ); + } + } + @Override public void disconnected(Channel channel) throws Exception {