From cfd10f57149d2941662e477b78c3c1f5f187c219 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 11 Mar 2013 09:47:42 +1100 Subject: [PATCH] Handle when user gets kicked midway through login to other server --- proxy/src/main/java/net/md_5/bungee/ServerConnector.java | 7 +++++++ .../java/net/md_5/bungee/connection/DownstreamBridge.java | 6 +++--- 2 files changed, 10 insertions(+), 3 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 152b8424..bc21a10f 100644 --- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java +++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java @@ -95,6 +95,13 @@ public class ServerConnector extends PacketHandler user.getServer().disconnect( "Quitting" ); } + // TODO: Fix this? + if ( !user.ch.isActive() ) + { + server.disconnect( "Quitting" ); + throw new IllegalStateException( "No client connected for pending server!" ); + } + // Add to new server // TODO: Move this to the connected() method of DownstreamBridge target.addPlayer( user ); diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java index 1d4223c1..b724b14a 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java @@ -13,7 +13,6 @@ import net.md_5.bungee.Util; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.connection.ProxiedPlayer; -import net.md_5.bungee.api.connection.Server; import net.md_5.bungee.api.event.ChatEvent; import net.md_5.bungee.api.event.PluginMessageEvent; import net.md_5.bungee.packet.Packet0KeepAlive; @@ -44,8 +43,9 @@ public class DownstreamBridge extends PacketHandler server.getInfo().removePlayer( con ); bungee.getReconnectHandler().setServer( con ); - if (!server.isObsolete()){ - con.disconnect( "[Proxy] Lost connection to server D:" ); + if ( !server.isObsolete() ) + { + con.disconnect( "[Proxy] Lost connection to server D:" ); } }