disconnect after 10 minutes dead

This commit is contained in:
2024-09-13 19:44:13 -05:00
parent 9a40e12dbc
commit 415ad5402f
+3 -38
View File
@@ -4815,43 +4815,8 @@ public class PlayerCharacter extends AbstractCharacter {
if (sourcePlayer == null)
return;
if (sourcePlayer.isAlive()) {
Logger.error("Player " + sourcePlayer.getObjectUUID() + " respawning while alive");
return;
}
// ResetAfterDeath player
sourcePlayer.respawnLock.writeLock().lock();
try {
sourcePlayer.respawn(true, false, true);
sourcePlayer.getClientConnection().disconnect();
} catch (Exception e) {
Logger.error(e);
} finally {
sourcePlayer.respawnLock.writeLock().unlock();
}
RespawnMsg msg = new RespawnMsg();
// Echo ResetAfterDeath message back
msg.setPlayerHealth(sourcePlayer.getHealth());
// TODO calculate any experience loss before this point
msg.setPlayerExp(sourcePlayer.getExp() + sourcePlayer.getOverFlowEXP());
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
MoveToPointMsg moveMsg = new MoveToPointMsg();
moveMsg.setPlayer(sourcePlayer);
moveMsg.setStartCoord(sourcePlayer.getLoc());
moveMsg.setEndCoord(sourcePlayer.getLoc());
moveMsg.setInBuilding(-1);
moveMsg.setUnknown01(-1);
dispatch = Dispatch.borrow(sourcePlayer, moveMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
MovementManager.sendRWSSMsg(sourcePlayer);
// refresh the whole group with what just happened
JobScheduler.getInstance().scheduleJob(new RefreshGroupJob(sourcePlayer), MBServerStatics.LOAD_OBJECT_DELAY);
}
@Override
@@ -4860,11 +4825,11 @@ public class PlayerCharacter extends AbstractCharacter {
if (this.updateLock.writeLock().tryLock()) {
try {
if (!this.isAlive()) {
if (!this.isAlive() && this.isEnteredWorld()) {
if(!this.timestamps.containsKey("DeathTime")){
this.timestamps.put("DeathTime",System.currentTimeMillis());
}
if((System.currentTimeMillis() - this.timestamps.get("DeathTime")) > 600000)
if((System.currentTimeMillis() - this.timestamps.get("DeathTime")) > 6000)//00)
forceRespawn(this);
return;
}