From 04a6eff14cdecfc9fe22d238f555601e5c0aa41c Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 1 Mar 2016 11:53:59 +1100 Subject: [PATCH] Don't handle exceptions for obsolete server connectors. --- .../java/net/md_5/bungee/ServerConnector.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java index 4e6261a4..9d05b39d 100644 --- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java +++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java @@ -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. @@ -256,10 +261,11 @@ public class ServerConnector extends PacketHandler @Override public void handle(Kick kick) throws Exception { - user.setLastServerJoined(user.getLastServerJoined() + 1); + user.setLastServerJoined( user.getLastServerJoined() + 1 ); String serverName = ""; List 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 ); @@ -267,7 +273,7 @@ public class ServerConnector extends PacketHandler { def = null; } - ServerKickEvent event = new ServerKickEvent(user, target, ComponentSerializer.parse(kick.getMessage()), def, ServerKickEvent.State.CONNECTING); + ServerKickEvent event = new ServerKickEvent( user, target, ComponentSerializer.parse( kick.getMessage() ), def, ServerKickEvent.State.CONNECTING ); if ( event.getKickReason().toLowerCase().contains( "outdated" ) && def != null ) { // Pre cancel the event if we are going to try another server @@ -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; }