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