Manages callbacks that are connected to an event that fires before chat messages are sent.

Example

chatSendEvent.ts

import { world } from "@minecraft/server";

// Subscribe to the blockExplode event
world.beforeEvents.chatSend.subscribe((event) => {
const { sender, message } = event;
console.log(`${sender.name}: ${message}`);

event.cancel = true; // Cancel message to be sent if needed.
});

Hierarchy

  • ChatSendBeforeEventSignal

Constructors

Methods

Constructors

Methods

  • Parameters

    Returns ((arg) => void)

      • (arg): void
      • Parameters

        Returns void

        Remarks

        Adds a callback that will be called before new chat messages are sent.

        This function can't be called in read-only mode.

        This function can be called in early-execution mode.

    Remarks

    Adds a callback that will be called before new chat messages are sent.

    This function can't be called in read-only mode.

    This function can be called in early-execution mode.

  • Parameters

    Returns void

    Remarks

    Removes a callback from being called before new chat messages are sent.

    This function can't be called in read-only mode.

    This function can be called in early-execution mode.