First Config
First Config
Section titled “First Config”This is the normal DaisyConfig starting flow:
- define a typed config class
- define a codec
- load it from YAML
- keep it in a reload-safe handle
data class ProfileUiConfig( val icon: Material, val sidebarTitle: String,)
val profileUiCodec = objectCodec { ProfileUiConfig( icon = required("icon", materialCodec()), sidebarTitle = defaulted("sidebar_title", stringCodec(), "<gradient:#7dd3fc:#c4b5fd>Profile</gradient>"), ) }class MyPlugin : JavaPlugin() { lateinit var profileConfig: DaisyConfigHandle<ProfileUiConfig> private set
override fun onEnable() { ensureDefaultConfigResource("profile-ui.yml") profileConfig = yamlConfigHandle("profile-ui.yml", profileUiCodec) }}What this gives you
Section titled “What this gives you”- typed values instead of raw string lookups
- DaisySeries parsing for config-heavy value types
- a stable
currentconfig value - safe reload behavior
Next steps
Section titled “Next steps”- Learn reload behavior: Reload-Safe Configs
- Pair it with DaisyCore: Use DaisyConfig with DaisyCore
- Learn the codec surface: Config Codecs
When to move beyond the simple path
Section titled “When to move beyond the simple path”Keep this unmanaged flow when:
- one file is enough
- you do not need version-aware migration
- you do not need missing-key merge
- your plugin does not use module-style config bundles
Move to the Phase 3 path when:
- files need
config_version - bundled defaults add keys over time
- old keys need rename/remove migrations
- your plugin uses
modules/<category>/<module>/settings.ymlandlang.yml
Next: