From cbd9021cfaef80ca15723ce359b6f5c61537dfd9 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 19 Jan 2023 17:32:11 -0500 Subject: [PATCH] Setting last claimer properly during claim. --- src/engine/objects/Mine.java | 14 +------------- .../powers/poweractions/ClaimMinePowerAction.java | 5 ++++- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/engine/objects/Mine.java b/src/engine/objects/Mine.java index 6213ac83..5ff0f1fe 100644 --- a/src/engine/objects/Mine.java +++ b/src/engine/objects/Mine.java @@ -548,19 +548,7 @@ public class Mine extends AbstractGameObject { if (!updateGuildOwner(claimer)) return false; - // Not the Same session for this character? - // Claimers may not relog or they lose claim. - - if (this.lastClaimer != null) { - - if (SessionManager.getSession(lastClaimer).getSessionID() != - this.lastClaimerSessionID) { - this.lastClaimer = null; - this.lastClaimerSessionID = null; - Mine.setLastChange(System.currentTimeMillis()); - return false; - } - } + this.lastClaimer = claimer; // Successful claim return true; diff --git a/src/engine/powers/poweractions/ClaimMinePowerAction.java b/src/engine/powers/poweractions/ClaimMinePowerAction.java index 6dd896d3..d18d1704 100644 --- a/src/engine/powers/poweractions/ClaimMinePowerAction.java +++ b/src/engine/powers/poweractions/ClaimMinePowerAction.java @@ -28,12 +28,15 @@ public class ClaimMinePowerAction extends AbstractPowerAction { @Override protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) { + if (source == null || awo == null) return; if (!(source.getObjectType().equals(Enum.GameObjectType.PlayerCharacter))) return; + PlayerCharacter playerCharacter = (PlayerCharacter) source; + if (!(awo.getObjectType().equals(Enum.GameObjectType.Building))) return; @@ -47,7 +50,7 @@ public class ClaimMinePowerAction extends AbstractPowerAction { if (mine == null) return; - if (mine.claimMine((PlayerCharacter) source) == true) + if (mine.claimMine(playerCharacter) == true) ChatManager.sendSystemMessage( (PlayerCharacter) source, "You successfully claimed this mine.."); else ChatManager.sendSystemMessage( (PlayerCharacter) source, "Your attempt for to claim this mine failed.");