def formula

This commit is contained in:
2025-02-02 14:29:26 -06:00
parent 1ffcc1086b
commit 773b6253b9
2 changed files with 9 additions and 21 deletions
@@ -93,13 +93,10 @@ public enum SimulationManager {
} }
try { try {
if ((_updatePulseTime != 0) if ((_updatePulseTime != 0) && (System.currentTimeMillis() > _updatePulseTime))
&& (System.currentTimeMillis() > _updatePulseTime))
pulseUpdate(); pulseUpdate();
} catch (Exception e) { } catch (Exception e) {
Logger.error( Logger.error("Fatal error in Update Pulse: DISABLED");
"Fatal error in Update Pulse: DISABLED");
// _runegatePulseTime = 0;
} }
try { try {
@@ -160,7 +157,11 @@ public enum SimulationManager {
if (player == null) if (player == null)
continue; continue;
player.update(false); try {
player.update(true);
}catch(Exception e){
}
} }
_updatePulseTime = System.currentTimeMillis() + 500; _updatePulseTime = System.currentTimeMillis() + 500;
+2 -15
View File
@@ -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();