From 415ad5402f0570645f65254855cc9f4904bc6645 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Fri, 13 Sep 2024 19:44:13 -0500 Subject: [PATCH] disconnect after 10 minutes dead --- src/engine/objects/PlayerCharacter.java | 41 ++----------------------- 1 file changed, 3 insertions(+), 38 deletions(-) diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 41aa0964..9f99221e 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -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 { 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; }