Skip to content

ConfigSpecList

class ConfigSpecList<T : ConfigSpec>(
    title: Component, 
    id: String = title.string.toSnakeCase(), 
    directory: String = id, 
    synchronized: Boolean = false, 
    factory: (entryId: String) -> T
) : ConfigSpecCollection<T> 

A ConfigSpecCollection exposed as an ordered entries list.

Constructors

ConfigSpecList

constructor(
    title: Component, 
    id: String = title.string.toSnakeCase(), 
    directory: String = id, 
    synchronized: Boolean = false, 
    factory: (entryId: String) -> T
)

Properties

directory

Parameters

  • directory: Subfolder (under whatever baseFolder resolves to) this collection's files live in. Defaults to id.

entries

val entries: List<T>

The current entries, in discovery/insertion order.

id

open override val id: String

Stable identifier - this node's path segment when nested under a ConfigGroup.

synchronized

Parameters

  • synchronized: Whether factory produces ConfigSpec.Server entries that should sync to clients, server-authoritative: the server broadcasts which entries exist (a client's own add/remove is disabled in the UI - see buildCollectionEntry), and an existing entry's values sync like a normal ConfigSpec.Server's (permission-gated edits, reverted with a message if denied). All entries share one channel, registered once at attach time - a fresh payload type per entry can't be negotiated once the server has already accepted connections, so entries can't each get their own the way a standalone ConfigSpec.Server does.

title

open override val title: Component

Display title shown for this node's row in its parent's screen.

Functions

add

fun add(entryId: String): T

Creates, saves, and registers a new entry for entryId. For a synchronized collection, only ever call this server-side - see the class doc.

remove

fun remove(entryId: String)

Deletes entryId's file and drops it from this collection. No-op if absent. For a synchronized collection, only ever call this server-side - see the class doc.