GraphMine

graphmine-core / io.github.sof3.graphmine.command / Command

Command

abstract class Command<C : Scope>

This class represents a command type. Each instance of Command should represent one registered command.

Subclasses must initialize the name property.

/**
 * Implements the /version command
 */
object VersionCommand : Command<Server>({
	name = "graphmine.version".qualify()
	aliases += "v"

	description = CoreLang.commands.version.description(Unit)

	handle<EmptyOverload, CommandSender> {
		respond(CoreLang.commands.version.response(VersionResponse(VersionInfo.VERSION)))
	}
})

Parameters

fn - A lambda to initialize the command.

Constructors

<init> Command(fn: Command<C>.() -> Unit)
This class represents a command type. Each instance of Command should represent one registered command.

Properties

aliases var aliases: List<String>
The list of aliases
description var description: I18n
The description of the command, shown in action lists like /help.
name lateinit var name: Qualifier
The qualified name of the command.
scope lateinit var scope: C
The scope that owns the command

Functions

dispatch fun dispatch(reader: FormattedStringReader, sender: CommandSender, receiver: CommandReceiver): Job
Executes the command.
handle fun <A : Overload, S : CommandSender> handle(fn: suspend CommandExecutor<A, S, C>.() -> Unit): Unit
Adds a handler to the command.

Inheritors

VersionCommand object VersionCommand : Command<Server>
Implements the /version command