fix(api): fixes

This commit is contained in:
2025-11-27 09:47:34 +01:00
parent 4360bb55f7
commit 579209aa69
4 changed files with 53 additions and 30 deletions

View File

@@ -47,11 +47,11 @@ class UserSession(val user: User, val host: Boolean, val gameLobby: GameLobby) e
case "StartGame" =>
gameLobby.startGame(user)
case "PlayCard" =>
val maybeCardIndex: Option[Int] = (data \ "cardindex").asOpt[Int]
val maybeCardIndex: Option[String] = (data \ "cardindex").asOpt[String]
maybeCardIndex match {
case Some(index) =>
val session = gameLobby.getUserSession(user.id)
gameLobby.playCard(session, index)
gameLobby.playCard(session, index.toInt)
case None =>
println("Card Index not found or is not a number.")
}
@@ -69,7 +69,6 @@ class UserSession(val user: User, val host: Boolean, val gameLobby: GameLobby) e
lock.unlock()
if (result.isFailure) {
val throwable = result.failed.get
throwable.printStackTrace()
throw throwable
}
}