feat(auth): implemented users and user auth

#5 [Story] Create User Sessions
This commit is contained in:
2025-10-26 11:24:05 +01:00
parent 03f1811ab4
commit 158238da80
13 changed files with 115 additions and 46 deletions

View File

@@ -0,0 +1,37 @@
package logic
import de.knockoutwhist.utils.events.SimpleEvent
import model.sessions.PlayerSession
import java.util.UUID
import scala.collection.mutable
object PodGameManager {
private val sessions: mutable.Map[UUID, PlayerSession] = mutable.Map()
def addSession(session: PlayerSession): Unit = {
sessions.put(session.id, session)
}
def clearSessions(): Unit = {
sessions.clear()
}
def identify(id: UUID): Option[PlayerSession] = {
sessions.get(id)
}
def transmit(id: UUID, event: SimpleEvent): Unit = {
identify(id).foreach(_.updatePlayer(event))
}
def transmitAll(event: SimpleEvent): Unit = {
sessions.foreach(session => session._2.updatePlayer(event))
}
def listSessions(): List[PlayerSession] = {
sessions.values.toList
}
}