The ChatSendBeforeEvent interface in @minecraft/server.
Interface in @minecraft/server
Extends CancellableEvent
import type { ChatSendBeforeEvent } from '@minecraft/server';Subscribe to it with world.beforeEvents.chatSend.
Example
Section titled “Example”import { world, type ChatSendBeforeEvent } from '@minecraft/server';
world.beforeEvents.chatSend.subscribe((event: ChatSendBeforeEvent) => { console.log('chatSend', event.sender.name, event.message);
// Uncomment to stop it from happening. // event.cancel = true;});import { world } from '@minecraft/server';
world.beforeEvents.chatSend.subscribe((event) => { console.log('chatSend', event.sender.name, event.message);
// Uncomment to stop it from happening. // event.cancel = true;});Properties
Section titled “Properties”sender
Section titled “sender”read-only
readonly sender: Player;Types
message
Section titled “message”message: string;The message, which handlers may change.
Used by
Section titled “Used by”Inherited
Section titled “Inherited”From CancellableEvent: cancel