|
|
@ -4815,43 +4815,8 @@ public class PlayerCharacter extends AbstractCharacter { |
|
|
|
if (sourcePlayer == null) |
|
|
|
if (sourcePlayer == null) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (sourcePlayer.isAlive()) { |
|
|
|
sourcePlayer.getClientConnection().disconnect(); |
|
|
|
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); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// refresh the whole group with what just happened
|
|
|
|
|
|
|
|
JobScheduler.getInstance().scheduleJob(new RefreshGroupJob(sourcePlayer), MBServerStatics.LOAD_OBJECT_DELAY); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -4860,11 +4825,11 @@ public class PlayerCharacter extends AbstractCharacter { |
|
|
|
if (this.updateLock.writeLock().tryLock()) { |
|
|
|
if (this.updateLock.writeLock().tryLock()) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
if (!this.isAlive()) { |
|
|
|
if (!this.isAlive() && this.isEnteredWorld()) { |
|
|
|
if(!this.timestamps.containsKey("DeathTime")){ |
|
|
|
if(!this.timestamps.containsKey("DeathTime")){ |
|
|
|
this.timestamps.put("DeathTime",System.currentTimeMillis()); |
|
|
|
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); |
|
|
|
forceRespawn(this); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|