ConfigReader

Configurable reader for files, plugin configuration files, and layered sections.

File-backed readers write constructor defaults and normalized values back by default. Section-backed readers merge into an isolated in-memory configuration and never mutate their source sections.

Constructors

Link copied to clipboard
constructor(file: File)

Creates a reader backed by file.

constructor(plugin: Plugin)

Creates a reader backed by the plugin's config.yml.

constructor(vararg sections: ConfigurationSection?)

Creates a read-only reader from highest-to-lowest-priority sections.

Functions

Link copied to clipboard

Uses the file root as a lower-priority fallback for the section selected by section.

Link copied to clipboard
fun fallbackSection(targetPath: String, sourcePath: String): ConfigReader

Fills missing values below targetPath from sourcePath.

fun fallbackSection(targetPath: String, source: ConfigurationSection?): ConfigReader

Fills missing values below targetPath from source.

Link copied to clipboard
inline fun <T : Any> read(): T

Reads the configured source as T.

fun <T : Any> read(clazz: KClass<T>): T

Reads the configured source as clazz.

Link copied to clipboard

Reads from a nested section instead of the source root. Missing sections are created only for file-backed readers when writing is enabled.

Link copied to clipboard

Controls whether a file-backed reader saves defaults and normalized values. This option has no effect on section-backed readers, which never mutate sources.