CommandContext

class CommandContext(sourceStack: CommandSourceStack)

Wrapper for Brigadier command context providing type-safe access to command sender and arguments.

Constructors

Link copied to clipboard
constructor(sourceStack: CommandSourceStack)

Properties

Link copied to clipboard

Whether the sender is a player

Link copied to clipboard
val player: Player?

The player if sender is a player, null otherwise

Link copied to clipboard
val sender: CommandSender

The raw command sender (player, console, or other)

Functions

Link copied to clipboard
fun reply(message: Component)

Sends a message to the command sender.

Link copied to clipboard
fun replyPlain(message: String)

Sends a plain text message to the command sender.

Link copied to clipboard
fun replyWithEvent(message: Component, event: ClickEvent)

Sends a message with a click event to the command sender.

Link copied to clipboard
fun requirePlayer(): Player

Requires the sender to be a player.