forked from MagicBane/Server
rentrant lock on modify health
This commit is contained in:
@@ -1787,7 +1787,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
final boolean fromCost) {
|
final boolean fromCost) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
this.combatLock.writeLock().lock();
|
||||||
try {
|
try {
|
||||||
boolean ready = this.healthLock.writeLock().tryLock(1, TimeUnit.SECONDS);
|
boolean ready = this.healthLock.writeLock().tryLock(1, TimeUnit.SECONDS);
|
||||||
|
|
||||||
@@ -1852,6 +1852,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
return newHealth - oldHealth;
|
return newHealth - oldHealth;
|
||||||
} finally {
|
} finally {
|
||||||
this.healthLock.writeLock().unlock();
|
this.healthLock.writeLock().unlock();
|
||||||
|
this.combatLock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
|
|||||||
Reference in New Issue
Block a user