Skip to content

First Config

This is the normal DaisyConfig starting flow:

  1. define a typed config class
  2. define a codec
  3. load it from YAML
  4. 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)
}
}
  • typed values instead of raw string lookups
  • DaisySeries parsing for config-heavy value types
  • a stable current config value
  • safe reload behavior

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.yml and lang.yml

Next: