forked from SteamWar/SteamWar
Refactor EventFights and Fight classes to improve player initialization and retrieval
Signed-off-by: Chaoscaot <max@maxsp.de>
This commit is contained in:
@@ -43,10 +43,10 @@ class Team(id: EntityID<Int>) : IntEntity(id) {
|
||||
private val teamCache = mutableMapOf<Int, Team>()
|
||||
|
||||
@JvmStatic
|
||||
fun clear() = teamCache.clear()
|
||||
fun clear() = synchronized(teamCache) { teamCache.clear() }
|
||||
|
||||
@JvmStatic
|
||||
fun byId(id: Int) = teamCache.computeIfAbsent(id) { useDb { Team[id] } }
|
||||
fun byId(id: Int) = synchronized(teamCache) { teamCache.computeIfAbsent(id) { useDb { Team[id] } } }
|
||||
|
||||
@JvmStatic
|
||||
fun get(name: String) = useDb { find { TeamTable.name.lowerCase() eq name.lowercase() or (TeamTable.kuerzel.lowerCase() eq name.lowercase()) }.firstOrNull() }
|
||||
|
||||
Reference in New Issue
Block a user