Kvinchik/src/main/kotlin/me/theentropyshard/kvinchik/database/impl/RuntimeDatabase.kt

27 lines
668 B
Kotlin

package me.theentropyshard.kvinchik.database.impl
import me.theentropyshard.kvinchik.database.Database
import me.theentropyshard.kvinchik.entity.KvinchikUser
import me.theentropyshard.kvinchik.util.search
class RuntimeDatabase : Database {
private val users: MutableList<KvinchikUser>
init {
this.users = ArrayList()
}
override fun userExists(id: Long): Boolean = users.search { it.id == id } != null
override fun saveUser(user: KvinchikUser) {
if (this.userExists(user.id)) {
return
}
this.users.add(user)
}
override fun getUsers(): List<KvinchikUser> {
return this.users
}
}