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

ru.astrainteractive.astralibs.lifecycle.Lifecycle.kt Maven / Gradle / Ivy

There is a newer version: 3.16.1
Show newest version
package ru.astrainteractive.astralibs.lifecycle

interface Lifecycle {

    fun onEnable() = Unit

    fun onDisable() = Unit

    fun onReload() = Unit

    class Lambda(
        private val onEnable: Lifecycle.() -> Unit = {},
        private val onDisable: Lifecycle.() -> Unit = {},
        private val onReload: Lifecycle.() -> Unit = {},
    ) : Lifecycle {
        override fun onEnable() {
            onEnable.invoke(this)
        }

        override fun onDisable() {
            onDisable.invoke(this)
        }

        override fun onReload() {
            onReload.invoke(this)
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy