From 1e26d7f38c4f4067054f7a873c7e8054519b8c95 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 29 Jan 2025 17:44:43 -0600 Subject: [PATCH] player lock fix --- src/engine/objects/PlayerCharacter.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 4b278f67..4591fc51 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -5040,8 +5040,11 @@ public class PlayerCharacter extends AbstractCharacter { //if(!newSystem) // return; 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) if (reentrantLock.isWriteLocked() || reentrantLock.getReadLockCount() > 0) { return; // Or throw an exception if needed