Fix #671 - user timing out when connectNow is used.

This commit is contained in:
md_5 2013-11-01 17:46:41 +11:00
parent a0d3bf97d1
commit 26863032a1
2 changed files with 7 additions and 2 deletions

View File

@ -177,6 +177,7 @@ public class ServerConnector extends PacketHandler
// TODO: Move this to the connected() method of DownstreamBridge // TODO: Move this to the connected() method of DownstreamBridge
target.addPlayer( user ); target.addPlayer( user );
user.getPendingConnects().remove( target ); user.getPendingConnects().remove( target );
user.setDimensionChange( false );
user.setServer( server ); user.setServer( server );
ch.getHandle().pipeline().get( HandlerBoss.class ).setHandler( new DownstreamBridge( bungee, user, server ) ); ch.getHandle().pipeline().get( HandlerBoss.class ).setHandler( new DownstreamBridge( bungee, user, server ) );
@ -211,7 +212,7 @@ public class ServerConnector extends PacketHandler
} }
String message = bungee.getTranslation( "connect_kick" ) + target.getName() + ": " + event.getKickReason(); String message = bungee.getTranslation( "connect_kick" ) + target.getName() + ": " + event.getKickReason();
if ( user.getServer() == null ) if ( user.isDimensionChange() )
{ {
user.disconnect( message ); user.disconnect( message );
} else } else

View File

@ -60,6 +60,9 @@ public final class UserConnection implements ProxiedPlayer
@Setter @Setter
private ServerConnection server; private ServerConnection server;
@Getter @Getter
@Setter
private boolean dimensionChange = true;
@Getter
private final Object switchMutex = new Object(); private final Object switchMutex = new Object();
@Getter @Getter
private final Collection<ServerInfo> pendingConnects = new HashSet<>(); private final Collection<ServerInfo> pendingConnects = new HashSet<>();
@ -161,6 +164,7 @@ public final class UserConnection implements ProxiedPlayer
void sendDimensionSwitch() void sendDimensionSwitch()
{ {
dimensionChange = true;
unsafe().sendPacket( PacketConstants.DIM1_SWITCH ); unsafe().sendPacket( PacketConstants.DIM1_SWITCH );
unsafe().sendPacket( PacketConstants.DIM2_SWITCH ); unsafe().sendPacket( PacketConstants.DIM2_SWITCH );
} }
@ -224,7 +228,7 @@ public final class UserConnection implements ProxiedPlayer
connect( def, false ); connect( def, false );
} else } else
{ {
if ( server == null ) if ( dimensionChange )
{ {
disconnect( bungee.getTranslation( "fallback_kick" ) + future.cause().getClass().getName() ); disconnect( bungee.getTranslation( "fallback_kick" ) + future.cause().getClass().getName() );
} else } else