k Spigot Config
inline fun <T : Any> kSpigotConfig(file: File, saveAfterLoad: Boolean = false, stringFormat: Json = Json, noinline default: () -> T? = null): ConfigDelegate<T>
Content copied to clipboard
Creates a new ConfigDelegate object.
You can use this as a delegate (with by) or a normal object. (Delegate allows direct access to the config object, but does not provide save() or reload() methods.)
Parameters
T
The class type of the config.
file
The path to the config.
saveAfterLoad
If true, the loaded config will be saved immediately. This is useful, if the config structure was changed and new default parameters were applied.
default
Optional default config, which will be used if there is no config file and a new one should be created.
json
The json instance to use for serialization.
Throws
If the file does not exist and no default config is specified.