Skip to content

First Command

This page shows the normal DaisyCore command workflow:

  • define a command group
  • annotate it with @DaisyCommandSet
  • let DaisyPlatform discover it at startup
  • use direct MiniMessage strings by default

reply("...") is already MiniMessage-first.

That means this is normal DaisyCore code:

reply("<gradient:#7dd3fc:#c4b5fd>Opening your profile.</gradient>")

You do not need:

  • a key
  • a DaisyTextSource
  • a config file

just to send a normal formatted message.

package cat.daisy.example.command
import cat.daisy.command.DaisyCommandGroup
import cat.daisy.command.DaisyCommandSet
@DaisyCommandSet
object ProfileCommands : DaisyCommandGroup({
command("profile") {
description("Open your profile tools")
player {
reply("<gradient:#7dd3fc:#c4b5fd>Opening your profile.</gradient>")
}
}
})
command("profile") {
description("Open your profile tools")
subcommand("open") {
player {
reply("<green>Profile opened.</green>")
}
}
}
subcommand("sync") {
player {
loading()
profileService.sync(player.uniqueId).replyResult(
context = this,
success = {
reply("<green>Profile synced for <white>${player.name}</white>.</green>")
},
failure = { error ->
fail("<red>Profile sync failed:</red> <gray>${error.message.orEmpty()}</gray>")
},
)
}
}

Step 4: use shared config-backed text only when it helps

Section titled “Step 4: use shared config-backed text only when it helps”

If your plugin already stores text in lang.yml, admin-editable config, or translation bundles, then replyLang(...) becomes the clean scaling path.

command("profile") {
description("Open your profile tools")
player {
replyLang("profile.opening", "player" to player.name)
}
}

That key is just your plugin’s own path.

It is useful when you want:

  • reloadable text
  • shared wording across systems
  • localization
  • large config-driven message sets

It is not required for a basic command.

If your plugin is already component-first, you can still send components directly:

reply(
Component.text("Profile opened.")
.color(NamedTextColor.AQUA)
)

The recommended order is:

  1. direct MiniMessage strings
  2. components when you want explicit control
  3. config-backed keys when you want shared or reloadable text

When commands() is enabled in your DaisyPlatform builder, DaisyCore scans your plugin jar for types annotated with @DaisyCommandSet.

That means normal usage does not require manual command provider registration.