|
|
@ -5037,19 +5037,9 @@ public class PlayerCharacter extends AbstractCharacter { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void update(Boolean newSystem) { |
|
|
|
public void update(Boolean newSystem) { |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
if(!newSystem) |
|
|
|
ReentrantReadWriteLock reentrantLock = (ReentrantReadWriteLock) this.updateLock; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if(reentrantLock.writeLock().isHeldByCurrentThread()){ |
|
|
|
|
|
|
|
this.updateLock.writeLock().unlock(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Check if the lock is currently held by another thread (either for reading or writing)
|
|
|
|
|
|
|
|
if (reentrantLock.isWriteLocked() || reentrantLock.getReadLockCount() > 0) { |
|
|
|
|
|
|
|
return; // Or throw an exception if needed
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}catch(Exception e){ |
|
|
|
|
|
|
|
//Logger.error(e);
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (this.updateLock.writeLock().tryLock()) { |
|
|
|
if (this.updateLock.writeLock().tryLock()) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (!this.isAlive() && this.isEnteredWorld()) { |
|
|
|
if (!this.isAlive() && this.isEnteredWorld()) { |
|
|
@ -5069,8 +5059,6 @@ public class PlayerCharacter extends AbstractCharacter { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.combatStats.update(); |
|
|
|
this.combatStats.update(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//this.doRegen();
|
|
|
|
|
|
|
|
this.doRegen(); |
|
|
|
this.doRegen(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -5125,7 +5113,6 @@ public class PlayerCharacter extends AbstractCharacter { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
this.updateLock.writeLock().unlock(); |
|
|
|
|
|
|
|
Logger.error(e); |
|
|
|
Logger.error(e); |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
this.updateLock.writeLock().unlock(); |
|
|
|
this.updateLock.writeLock().unlock(); |
|
|
|