load

inline fun <T : Any> load(plugin: Plugin, autoReload: Boolean = false, noinline onReload: (T) -> Unit = {}): T

Loads the configuration of type T for the plugin.

The configuration file is assumed to be "config.yml" in the plugin's data folder.

Return

the loaded configuration instance of type T

Parameters

T

the type of the configuration class

plugin

the Plugin instance

autoReload

whether to automatically reload the config when the file changes

onReload

a callback function to execute when the config is reloaded


inline fun <T : Any> load(file: File): T

Loads the configuration of type T from the specified file.

Return

the loaded configuration instance of type T

Parameters

T

the type of the configuration class

file

the configuration File


fun <T : Any> load(plugin: Plugin, clazz: KClass<T>, autoReload: Boolean = false, onReload: (T) -> Unit = {}): T

Loads the configuration of type T for the plugin.

The configuration file is assumed to be "config.yml" in the plugin's data folder.

Return

the loaded configuration instance of type T

Parameters

T

the type of the configuration class

plugin

the Plugin instance

clazz

the KClass of the configuration type T

autoReload

whether to automatically reload the config when the file changes

onReload

a callback function to execute when the config is reloaded