fix: improve lock handling in user session interactions

This commit is contained in:
2025-11-05 11:18:38 +01:00
parent 32d4f9c6ce
commit 5165fce746
2 changed files with 2 additions and 2 deletions

View File

@@ -185,7 +185,7 @@ class GameLobby private(
}
private def getPlayerInteractable(userSession: UserSession, iType: InteractionType): AbstractPlayer = {
if (!Thread.holdsLock(userSession.lock)) {
if (!userSession.lock.isHeldByCurrentThread) {
throw new IllegalStateException("The user session is not locked!")
}
if (userSession.canInteract.isEmpty || userSession.canInteract.get != iType) {