Browse Source

disconnect after 10 minutes dead

lakebane-mine-tele
FatBoy-DOTC 3 months ago
parent
commit
415ad5402f
  1. 41
      src/engine/objects/PlayerCharacter.java

41
src/engine/objects/PlayerCharacter.java

@ -4815,43 +4815,8 @@ public class PlayerCharacter extends AbstractCharacter { @@ -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);
} 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);
sourcePlayer.getClientConnection().disconnect();
// 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 { @@ -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;
}

Loading…
Cancel
Save