player lock fix

This commit is contained in:
2025-01-29 17:44:43 -06:00
parent 64f9f4d4b9
commit 1e26d7f38c
+4 -1
View File
@@ -5040,8 +5040,11 @@ public class PlayerCharacter extends AbstractCharacter {
//if(!newSystem) //if(!newSystem)
// return; // return;
try { try {
ReentrantReadWriteLock reentrantLock = (ReentrantReadWriteLock) updateLock; ReentrantReadWriteLock reentrantLock = (ReentrantReadWriteLock) this.updateLock;
if(reentrantLock.writeLock().isHeldByCurrentThread()){
this.updateLock.writeLock().unlock();
}
// Check if the lock is currently held by another thread (either for reading or writing) // Check if the lock is currently held by another thread (either for reading or writing)
if (reentrantLock.isWriteLocked() || reentrantLock.getReadLockCount() > 0) { if (reentrantLock.isWriteLocked() || reentrantLock.getReadLockCount() > 0) {
return; // Or throw an exception if needed return; // Or throw an exception if needed