LifecycleListener extensions

For an easy way to access a Config from a LifecycleListener( Your manager ) you can use delegate properties config.

class YourManager(override val plugin: YourPlugin) : LifecycleListener<YourPlugin> {

  val yourConfig: YourConfig by config<YourConfig>()

}

You can use a mapper to get a specific property that you want.

  val kits: List<Kit> by config<YourConfig> { kits }
inline fun <reified T : Any, R> LifecycleListener<*>.config(
        noinline deep: T.() -> R
): ConfigDelegate<T, R>

Last updated