All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.skillw.pouvoir.internal.manager.DatabaseManagerImpl.kt Maven / Gradle / Ivy

There is a newer version: 1.6.7-beta-6
Show newest version
package com.skillw.pouvoir.internal.manager

import com.skillw.pouvoir.Pouvoir
import com.skillw.pouvoir.api.feature.database.BaseContainer
import com.skillw.pouvoir.api.feature.database.ContainerHolder
import com.skillw.pouvoir.api.manager.sub.DatabaseManager
import com.skillw.pouvoir.api.plugin.map.DataMap

internal object DatabaseManagerImpl : DatabaseManager() {
    override val key = "DatabaseManager"
    override val priority = 10
    override val subPouvoir = Pouvoir

    override fun containerHolder(data: DataMap): ContainerHolder<*>? {
        val type = data.get("type", "sqlite")
        return get(type)?.connectWith(data)
    }

    override fun onActive() {
        values.forEach {
            it.containers().forEach(BaseContainer::onActive)
        }
    }

    override fun onReload() {
        values.forEach {
            it.containers().forEach(BaseContainer::onReload)
        }
    }

    override fun onDisable() {
        values.forEach {
            it.containers().forEach(BaseContainer::onDisable)
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy