Command

class Command(name: String, onExecute: (CommandExecutor) -> Unit)

Representation of a command

Parameters

name

The name of the command

onExecute

The function to execute when the command is executed.

Constructors

Link copied to clipboard
fun Command(name: String, onExecute: (CommandExecutor) -> Unit = {})

Functions

Link copied to clipboard
fun consoleOnly(): Command

Makes this command to be executable only through console

Link copied to clipboard
fun playersOnly(): Command

Makes this command to be executable only by players

Link copied to clipboard
fun require(message: String, check: (CommandSender) -> Boolean): Command

Adds a new requirement to the command

Link copied to clipboard
fun subCommand(signature: String, tabCompletions: (CommandSender) -> Map<String, Collection<String>> = { emptyMap() }, executor: (CommandExecutor) -> Unit): Command

Registers an argument to this command

Link copied to clipboard
fun withAlias(vararg aliases: String): Command

Adds the given aliases to the command

Link copied to clipboard
fun withPermission(permission: String): Command

Sets the command permission to the given permission

Link copied to clipboard
fun withTabCompleter(tabCompleter: (CommandSender, Array<String>) -> Collection<String>): Command

Replaces the default tab completer for this command

Properties

Link copied to clipboard
val aliases: MutableList<String>
Link copied to clipboard
var commandType: CommandType
Link copied to clipboard
val name: String
Link copied to clipboard
val onExecute: (CommandExecutor) -> Unit
Link copied to clipboard
var permission: String? = null
Link copied to clipboard
val requirements: MutableList<CommandRequirement<CommandSender>>
Link copied to clipboard
val subCommands: MutableList<SubCommand>
Link copied to clipboard
var tabCompleter: (CommandSender, Array<String>) -> Collection<String>