From 8e70e0597eac9c06a1675c0aa0c337fd784145c5 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Mon, 3 Jun 2024 20:37:03 -0500 Subject: [PATCH] rentrant lock on modify health --- src/engine/objects/AbstractCharacter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/engine/objects/AbstractCharacter.java b/src/engine/objects/AbstractCharacter.java index 7c48a3cd..8baf65d1 100644 --- a/src/engine/objects/AbstractCharacter.java +++ b/src/engine/objects/AbstractCharacter.java @@ -1787,7 +1787,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { final boolean fromCost) { try { - + this.combatLock.writeLock().lock(); try { boolean ready = this.healthLock.writeLock().tryLock(1, TimeUnit.SECONDS); @@ -1852,6 +1852,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { return newHealth - oldHealth; } finally { this.healthLock.writeLock().unlock(); + this.combatLock.writeLock().unlock(); } } catch (InterruptedException e) { // TODO Auto-generated catch block