Skip to content

First Command

This page shows the normal DaisyCore command workflow: define a provider, annotate it, and let DaisyPlatform discover it during startup.

You will create a /profile command that only players can run.

package cat.daisy.example.command
import cat.daisy.command.DaisyCommand
import cat.daisy.command.DaisyCommandProvider
import cat.daisy.command.DaisyCommandSet
import cat.daisy.command.dsl.command
@DaisyCommandSet
object ProfileCommands : DaisyCommandProvider {
override fun commands(): List<DaisyCommand> =
listOf(
command("profile") {
description("Open your profile tools")
executePlayer {
reply("Opening your profile soon.")
}
},
)
}
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.

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.

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.