First Command
First Command
Section titled “First Command”This page shows the normal DaisyCore command workflow: define a provider, annotate it, and let DaisyPlatform discover it during startup.
What this page assumes
Section titled “What this page assumes”- you have already completed Install DaisyCore
- your plugin already creates a
DaisyPlatformlike the one shown in First Plugin
What you’ll build
Section titled “What you’ll build”You will create a /profile command that only players can run.
Step 1: create a provider
Section titled “Step 1: create a provider”package cat.daisy.example.command
import cat.daisy.command.DaisyCommandimport cat.daisy.command.DaisyCommandProviderimport cat.daisy.command.DaisyCommandSetimport cat.daisy.command.dsl.command
@DaisyCommandSetobject ProfileCommands : DaisyCommandProvider { override fun commands(): List<DaisyCommand> = listOf( command("profile") { description("Open your profile tools")
executePlayer { reply("Opening your profile soon.") } }, )}Step 2: add a subcommand
Section titled “Step 2: add a subcommand”command("profile") { description("Open your profile tools")
sub("open") { executePlayer { reply("Opening your profile.") } }}command(...) and sub(...) stay short because they are DSL verbs. The long-lived public types stay Daisy-branded so the library ownership is obvious.
Step 3: use startup availability
Section titled “Step 3: use startup availability”Use enabled { ... } when a command should depend on config or plugin state at startup.
sub("debug") { enabled { plugin.config.getBoolean("commands.profile.debug") }
executePlayer { reply("Debug mode.") }}Use ignore(true) if you want a simple hard off switch.
How discovery works
Section titled “How discovery works”When commands() is enabled in your DaisyPlatform builder, DaisyCore scans your plugin jar for classes annotated with @DaisyCommandSet. Valid DaisyCommandProvider implementations are loaded automatically.
That means you do not manually register this provider in normal usage.
Next steps
Section titled “Next steps”- Learn the discovery model: Auto-Loaded Commands
- Open a UI from a command: First Menu
- Jump to API details: Command DSL