Skip to content

@minecraft/server


@minecraft/server / CustomCommandRegistry

Class: CustomCommandRegistry ​

Defined in: @minecraft/server/index.d.ts:7083

Provides the functionality for registering custom commands.

Methods ​

registerCommand() ​

registerCommand(customCommand, callback): void

Defined in: @minecraft/server/index.d.ts:7104

Parameters ​

customCommand ​

CustomCommand

callback ​

(origin, ...args) => CustomCommandResult | undefined

The callback triggered when the command executes.

Returns ​

void

Remarks ​

Registers a custom command that when executed triggers a script callback.

This function can't be called in restricted-execution mode.

This function can be called in early-execution mode.

Throws ​

This function can throw errors.

CustomCommandError

minecraftcommon.EngineError

NamespaceNameError


registerEnum() ​

registerEnum(name, values): void

Defined in: @minecraft/server/index.d.ts:7124

Parameters ​

name ​

string

values ​

string[]

Returns ​

void

Remarks ​

Registers a custom command enum.

This function can't be called in restricted-execution mode.

This function can be called in early-execution mode.

Throws ​

This function can throw errors.

CustomCommandError

minecraftcommon.EngineError

NamespaceNameError