Fixed multiple client logout and exit game.

This commit is contained in:
MobiusDevelopment 2019-11-24 21:30:03 +00:00
parent 760cc8fdf3
commit 07cb5d7dae
4 changed files with 15 additions and 7 deletions

View File

@ -36,7 +36,13 @@ public class MoveBackwardToLocation extends ClientBasePacket
final int originX = readD();
final int originY = readD();
final int originZ = readD();
final PlayerInstance activeChar = client.getActiveChar();
if (activeChar == null)
{
return;
}
if (activeChar.getCurrentState() == CreatureState.CASTING)
{
activeChar.sendPacket(new ActionFailed());

View File

@ -47,11 +47,11 @@ public class RequestRestart extends ClientBasePacket
return;
}
player.deleteMe();
player.sendPacket(new RestartResponse());
client.saveCharToDisk(client.getActiveChar());
client.setActiveChar(null);
client.saveCharToDisk(player);
player.sendPacket(new CharSelectInfo(client.getLoginName(), client.getSessionId()));
player.deleteMe();
client.setActiveChar(null);
}
}

View File

@ -24,8 +24,8 @@ public class LeaveWorld extends ServerBasePacket
@Override
public byte[] getContent()
{
_bao.write(150);
return _bao.toByteArray();
writeC(0x96);
return getBytes();
}
@Override

View File

@ -28,6 +28,7 @@ import java.util.List;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.network.serverpackets.LeaveWorld;
import org.l2jmobius.loginserver.LoginController;
import org.l2jmobius.loginserver.data.AccountData;
import org.l2jmobius.loginserver.network.clientpackets.RequestAuthLogin;
@ -140,13 +141,14 @@ public class ClientThread extends Thread
}
if (lc.isAccountInLoginServer(account))
{
_log.warning("Account is in use on Login server (kicking off):" + account);
// _log.warning("Account is in use on Login server (kicking off):" + account);
lc.getLoginServerConnection(account).close();
lc.removeLoginServerLogin(account);
}
if (lc.isAccountInGameServer(account))
{
_log.warning("Account is in use on Game server (kicking off):" + account);
// _log.warning("Account is in use on Game server (kicking off):" + account);
lc.getClientConnection(account).sendPacket(new LeaveWorld());
lc.getClientConnection(account).close();
lc.removeGameServerLogin(account);
}