From 5920f5a6bf6a5cd9d3283443f3eeb107054d9dc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= Date: Tue, 21 Apr 2026 18:58:50 +0200 Subject: [PATCH 1/2] fix(SentinelModule): improve target clearing logic during attack cooldown Ensure old targets are only retained when the sentinel is actively attacking them. Clear attack targets consistently when no valid target exists or the cooldown period ends without a valid old target. This prevents stale target references and ensures proper attack state reset. --- .../com/deeme/modules/SentinelModule.java | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/deeme/modules/SentinelModule.java b/src/main/java/com/deeme/modules/SentinelModule.java index ae4c4651..3d5e86c6 100644 --- a/src/main/java/com/deeme/modules/SentinelModule.java +++ b/src/main/java/com/deeme/modules/SentinelModule.java @@ -347,7 +347,10 @@ private GameMap getWorkingMap() { private boolean isAttacking() { if (this.randomWaitTime > System.currentTimeMillis()) { - return this.oldTarget != null; + if (shouldKeepOldTarget()) { + return true; + } + clearAttackTargets(); } if (sConfig.humanizer.addRandomTime) { @@ -373,11 +376,32 @@ private boolean isAttacking() { target = SharedFunctions.getAttacker(heroapi, npcs, heroapi); } + if (target == null) { + clearAttackTargets(); + return false; + } + changeTarget(target); this.oldTarget = target; - return target != null; + return true; + } + + private boolean shouldKeepOldTarget() { + if (this.oldTarget == null || !this.oldTarget.isValid() || this.sentinel == null) { + return false; + } + + Entity sentinelTarget = this.sentinel.getTarget(); + return sentinelTarget != null && sentinelTarget.getId() == this.oldTarget.getId(); + } + + private void clearAttackTargets() { + this.oldTarget = null; + this.isNpc = false; + this.attacker.setTarget(null); + this.shipAttacker.resetDefenseData(); } private void changeTarget(Entity target) { From a00f5ba8c8955f8b747cc9eb09ee3443e5155d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= Date: Sat, 25 Apr 2026 18:24:13 +0200 Subject: [PATCH 2/2] chore: update plugin version to 2.11.1 beta 5 --- src/main/resources/plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/plugin.json b/src/main/resources/plugin.json index 5e3bec5c..7d863920 100644 --- a/src/main/resources/plugin.json +++ b/src/main/resources/plugin.json @@ -1,7 +1,7 @@ { "name": "DmPlugin", "author": "Dm94Dani", - "version": "2.11.1 beta 4", + "version": "2.11.1 beta 5", "minVersion": "1.131.6 beta 3", "supportedVersion": "1.132.0", "basePackage": "com.deeme",