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 dd7a3e4e7..652e9c22a 100644 --- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java +++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java @@ -104,6 +104,17 @@ public class ServerConnector extends PacketHandler { Preconditions.checkState( thisState == State.LOGIN, "Not exepcting LOGIN" ); + synchronized ( user.getSwitchMutex() ) + { + if ( user.getServer() != null ) + { + user.sendDimensionSwitch(); + // Remove from old servers + user.getServer().setObsolete( true ); + user.getServer().disconnect( "Quitting" ); + } + } + final ServerConnection server = new ServerConnection( ch, target ); Callback callback = new Callback() { @@ -177,14 +188,8 @@ public class ServerConnector extends PacketHandler } serverScoreboard.clear(); - user.sendDimensionSwitch(); - user.setServerEntityId( login.getEntityId() ); user.unsafe().sendPacket( new Packet9Respawn( login.getDimension(), login.getDifficulty(), login.getGameMode(), (short) 256, login.getLevelType() ) ); - - // Remove from old servers - user.getServer().setObsolete( true ); - user.getServer().disconnect( "Quitting" ); } // TODO: Fix this?