From 64f9f4d4b90b259bdd9ee7195d7ec274c0a3ef8c Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 29 Jan 2025 17:38:00 -0600 Subject: [PATCH] player lock fix --- src/engine/objects/PlayerCharacter.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 59f1e8c4..4b278f67 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -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 {