Move some bootstrapping to the connected method, #267

This commit is contained in:
md_5 2013-04-27 12:27:40 +10:00
parent 6bf9df31f5
commit f44cf6c8e9
2 changed files with 15 additions and 9 deletions

View File

@ -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 );

View File

@ -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
{