Don't handle exceptions for obsolete server connectors.

This commit is contained in:
md_5 2016-03-01 11:53:59 +11:00
parent 05de455a9c
commit 04a6eff14c

View File

@ -53,6 +53,7 @@ public class ServerConnector extends PacketHandler
private State thisState = State.LOGIN_SUCCESS;
@Getter
private ForgeServerHandler handshakeHandler;
private boolean obsolete;
private enum State
{
@ -63,6 +64,11 @@ public class ServerConnector extends PacketHandler
@Override
public void exception(Throwable t) throws Exception
{
if ( obsolete )
{
return;
}
String message = "Exception Connecting:" + Util.exception( t );
if ( user.getServer() == null )
{
@ -92,8 +98,7 @@ public class ServerConnector extends PacketHandler
newHost += "\00" + BungeeCord.getInstance().gson.toJson( profile.getProperties() );
}
copiedHandshake.setHost( newHost );
}
else if ( !user.getExtraDataInHandshake().isEmpty() )
} else if ( !user.getExtraDataInHandshake().isEmpty() )
{
// Only restore the extra data if IP forwarding is off.
// TODO: Add support for this data with IP forwarding.
@ -259,7 +264,8 @@ public class ServerConnector extends PacketHandler
user.setLastServerJoined( user.getLastServerJoined() + 1 );
String serverName = "";
List<String> servers = user.getPendingConnection().getListener().getServerPriority();
if ( user.getLastServerJoined() < servers.size() ) {
if ( user.getLastServerJoined() < servers.size() )
{
serverName = servers.get( user.getLastServerJoined() );
}
ServerInfo def = ProxyServer.getInstance().getServers().get( serverName );
@ -276,6 +282,7 @@ public class ServerConnector extends PacketHandler
bungee.getPluginManager().callEvent( event );
if ( event.isCancelled() && event.getCancelServer() != null )
{
obsolete = true;
user.connect( event.getCancelServer() );
throw CancelSendSignal.INSTANCE;
}