CommandBuilder

class CommandBuilder(val name: String)

Builder class used to define and configure commands for the plugin.

This class allows you to define various aspects of a command such as its description, permission, usage, cooldowns, subcommands, and more. It also supports both synchronous and asynchronous execution of command logic, as well as tab completion and validation.

Parameters

name

The name of the command being built.

Constructors

Link copied to clipboard
constructor(name: String)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun cooldown(millis: Long, key: (CommandContext) -> String = { it.sender.name })

Sets a cooldown for the command.

Link copied to clipboard

Disables suggestions for tab completion.

Link copied to clipboard

Generates help text for the command, including subcommands.

Link copied to clipboard
fun run(block: CommandContext.() -> Unit)

Specifies the block of code to be executed when the command is run.

Link copied to clipboard
fun runAsync(block: suspend CommandContext.() -> Unit)

Specifies an asynchronous block of code to be executed when the command is run.

Link copied to clipboard
fun sub(name: String, builder: CommandBuilder.() -> Unit)

Defines a subcommand under the current command.

Link copied to clipboard
fun suggest(block: (CommandContext) -> List<String>)

Specifies the suggestions for tab completion.

Link copied to clipboard
inline fun <T : Enum<T>> suggestEnum(ignoreCase: Boolean = true)

Suggests values from an enum for tab completion.

Link copied to clipboard
fun suggestIf(condition: CommandContext.() -> Boolean, block: CommandContext.() -> List<String>)

Conditionally suggests tab completion options based on a condition.

Link copied to clipboard

Suggests the names of all online players for tab completion.

Link copied to clipboard
fun validate(block: CommandContext.() -> Unit)

Defines validation logic to be executed before the command is run.