Skip to content

Common

Types

General

Test

object Test : CategorySpec

Properties

categories

Top-level sections of this config.

configFolder

filename

open val filename: String

Path of the config file, relative to configFolder, without extension.

id

open override val id: String

isLoaded

Whether load has run at least once, or (for a synced spec) a value has been received from the server.

mod

val mod: Mod

predicate

open override val predicate: () -> Boolean

synchronized

open val synchronized: Boolean = false

title

open override val title: Component

type

Functions

init

open override fun init()

Registers all categories (and their subcategories) and, for a synchronized spec, registers this spec's NetworkChannel plus the player-join/quit listeners that push it to joining clients and reset isLoaded on disconnect.

load

fun load()

Reads the config file via fileSerializer, creating it with defaults if absent, marks isLoaded, and attaches/scans every DataSpec.configSpecList/DataSpec.configSpecMap field reachable from categories - deferred to here, rather than init, since configFolder isn't final until just before this runs (a Server spec only repoints it at the per-world folder right before calling load).

save

fun save()

Writes the current values of every field in categories to the config file via fileSerializer.