Interface in @minecraft/server
Extends CancellableEvent
Basalt’s own: a command a player typed, before it runs.
import type { PlayerCommandBeforeEvent } from '@minecraft/server';Subscribe to it with server.beforeEvents.playerCommand.
Example
Section titled “Example”import { server, type PlayerCommandBeforeEvent } from '@minecraft/server';
server.beforeEvents.playerCommand.subscribe((event: PlayerCommandBeforeEvent) => { console.log('playerCommand', event.player.name, event.command);
// Uncomment to stop it from happening. // event.cancel = true;});import { server } from '@minecraft/server';
server.beforeEvents.playerCommand.subscribe((event) => { console.log('playerCommand', event.player.name, event.command);
// Uncomment to stop it from happening. // event.cancel = true;});Properties
Section titled “Properties”player
Section titled “player”read-only
readonly player: Player;Types
command
Section titled “command”command: string;The command without its slash, which handlers may change.
Used by
Section titled “Used by”ServerBeforeEvents.playerCommand
Inherited
Section titled “Inherited”From CancellableEvent: cancel