From c6e06805832d2e1c567f7cb7cc39f9bbea64eb1f Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 20 Jan 2023 13:45:46 -0500 Subject: [PATCH] Mine claims released when leaving world. --- src/engine/server/world/WorldServer.java | 40 +++++++++++++----------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index 8d3d34c0..8e287c10 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -623,49 +623,53 @@ public class WorldServer { return; } - PlayerCharacter pc = SessionManager.getPlayerCharacter( + PlayerCharacter playerCharacter = SessionManager.getPlayerCharacter( origin); - if (pc == null) + if (playerCharacter == null) // TODO log this return; //cancel any trade - if (pc.getCharItemManager() != null) - pc.getCharItemManager().endTrade(true); + if (playerCharacter.getCharItemManager() != null) + playerCharacter.getCharItemManager().endTrade(true); + + // Release any mine claims + + Mine.releaseMineClaims(playerCharacter); // logout long delta = MBServerStatics.LOGOUT_TIMER_MS; - if (System.currentTimeMillis() - pc.getTimeStamp("LastCombatPlayer") < 60000) { + if (System.currentTimeMillis() - playerCharacter.getTimeStamp("LastCombatPlayer") < 60000) { delta = 60000; } - pc.stopMovement(pc.getLoc()); + playerCharacter.stopMovement(playerCharacter.getLoc()); UpdateStateMsg updateStateMsg = new UpdateStateMsg(); - updateStateMsg.setPlayer(pc); + updateStateMsg.setPlayer(playerCharacter); updateStateMsg.setActivity(5); - DispatchMessage.dispatchMsgToInterestArea(pc, updateStateMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false); + DispatchMessage.dispatchMsgToInterestArea(playerCharacter, updateStateMsg, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, false, false); - if (pc.getRegion() != null) - if (PlayerCharacter.CanBindToBuilding(pc, pc.getRegion().parentBuildingID)) - pc.bindBuilding = pc.getRegion().parentBuildingID; + if (playerCharacter.getRegion() != null) + if (PlayerCharacter.CanBindToBuilding(playerCharacter, playerCharacter.getRegion().parentBuildingID)) + playerCharacter.bindBuilding = playerCharacter.getRegion().parentBuildingID; else - pc.bindBuilding = 0; + playerCharacter.bindBuilding = 0; - pc.getLoadedObjects().clear(); - pc.getLoadedStaticObjects().clear(); + playerCharacter.getLoadedObjects().clear(); + playerCharacter.getLoadedStaticObjects().clear(); - LogoutCharacterJob logoutJob = new LogoutCharacterJob(pc, this); + LogoutCharacterJob logoutJob = new LogoutCharacterJob(playerCharacter, this); JobContainer jc = JobScheduler.getInstance().scheduleJob(logoutJob, System.currentTimeMillis() + delta); - pc.getTimers().put("Logout", jc); - pc.getTimestamps().put("logout", System.currentTimeMillis()); + playerCharacter.getTimers().put("Logout", jc); + playerCharacter.getTimestamps().put("logout", System.currentTimeMillis()); //send update to friends that you are logged off. - PlayerFriends.SendFriendsStatus(pc,false); + PlayerFriends.SendFriendsStatus(playerCharacter,false); }