Throw exception when ServerConnectEvent is handled badly

This commit is contained in:
md_5 2016-11-25 10:42:30 +11:00
parent 8574688be7
commit 4d004d5fed

View File

@ -217,7 +217,7 @@ public final class UserConnection implements ProxiedPlayer
public void connectNow(ServerInfo target) public void connectNow(ServerInfo target)
{ {
dimensionChange = true; dimensionChange = true;
connect(target); connect( target );
} }
public ServerInfo updateAndGetNextServer(ServerInfo currentTarget) public ServerInfo updateAndGetNextServer(ServerInfo currentTarget)
@ -252,6 +252,11 @@ public final class UserConnection implements ProxiedPlayer
{ {
callback.done( false, null ); callback.done( false, null );
} }
if ( getServer() == null && !ch.isClosing() )
{
throw new IllegalStateException("Cancelled ServerConnectEvent with no server or disconnect.");
}
return; return;
} }