Browse Source

player lock fix

lakebane
FatBoy-DOTC 24 hours ago
parent
commit
64f9f4d4b9
  1. 13
      src/engine/objects/PlayerCharacter.java

13
src/engine/objects/PlayerCharacter.java

@ -5039,13 +5039,16 @@ public class PlayerCharacter extends AbstractCharacter { @@ -5039,13 +5039,16 @@ public class PlayerCharacter extends AbstractCharacter {
//if(!newSystem)
// return;
ReentrantReadWriteLock reentrantLock = (ReentrantReadWriteLock) updateLock;
try {
ReentrantReadWriteLock reentrantLock = (ReentrantReadWriteLock) updateLock;
// 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
// 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()) {
try {

Loading…
Cancel
Save