Setting

abstract class Setting<T>(val container: KClass<*>, val name: String, val desc: String? = null, value: T, hidden: () -> Boolean = { false }, onChange: (T) -> Unit = {})(source)

A generic abstract class representing a setting that can be used in a settings container.

Parameters

T

The type of value this setting holds.

Constructors

Link copied to clipboard
constructor(container: KClass<*>, name: String, desc: String? = null, value: T, hidden: () -> Boolean = { false }, onChange: (T) -> Unit = {})

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The class of the settings container where this setting belongs.

Link copied to clipboard
val desc: String? = null
Link copied to clipboard

Check if the setting is hidden.

Link copied to clipboard

The name of the setting.

Link copied to clipboard
var value: T

The current value of the setting. Setting this property will trigger the onChange callback.

Functions

Link copied to clipboard
open operator fun getValue(ref: Any, prop: KProperty<*>): T

Get the value of the setting.

Link copied to clipboard
open operator fun setValue(ref: Any, prop: KProperty<*>, value: T)

Set the value of the setting. This will also trigger the onChange callback.