forked from SteamWar/SteamWar
Starting...
This commit is contained in:
@@ -46,7 +46,7 @@ data class ResponseSchematicType(val name: String, val db: String)
|
||||
data class ResponseUser(val name: String, val uuid: String, val prefix: String, val perms: List<String>) {
|
||||
constructor(user: SteamwarUser) : this(user.userName, user.uuid.toString(), user.prefix().chatPrefix, user.perms().filter { !it.name.startsWith("PREFIX_") }.map { it.name }) {
|
||||
synchronized(cache) {
|
||||
cache[user.id] = this
|
||||
cache[user.getId()] = this
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ data class ResponseUser(val name: String, val uuid: String, val prefix: String,
|
||||
|
||||
fun get(id: Int): ResponseUser {
|
||||
synchronized(cache) {
|
||||
return cache[id] ?: ResponseUser(SteamwarUser.get(id)).also { cache[id] = it }
|
||||
return cache[id] ?: ResponseUser(SteamwarUser.byId(id)!!).also { cache[id] = it }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ fun Route.configureDataRoutes() {
|
||||
permission = UserPerm.MODERATION
|
||||
}
|
||||
get("/users") {
|
||||
call.respond(SteamwarUser.getAll().map { ResponseUser(it) })
|
||||
call.respond(SteamwarUser.all().map { ResponseUser(it) })
|
||||
}
|
||||
get("/teams") {
|
||||
call.respond(Team.getAll().map { ResponseTeam(it) })
|
||||
|
||||
Reference in New Issue
Block a user