rentrant lock on modify health

This commit is contained in:
2024-06-03 20:37:03 -05:00
parent cf58e7b984
commit 8e70e0597e
+2 -1
View File
@@ -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