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
target.addPlayer( user );
user.getPendingConnects().remove( target );
user.setDimensionChange( false );
user.setServer( 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();
if ( user.getServer() == null )
if ( user.isDimensionChange() )
{
user.disconnect( message );
} else

View File

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