Skip to content

ChatRoute

Namespace Mc.Scripting · Kind class (static)

public static class ChatRoute

Restricts who gets a chat message while its handler runs. Signed chat stays signed: a restricted line is sent to the listed players only, as the engine’s own private messages are.

Member Description
static int Restrict(IEnumerable<Player> recipients) Restricts the recipients of the chat message of the running handler.
public static int Restrict(IEnumerable<Player> recipients)

Restricts the recipients of the chat message of the running handler. Only the listed players get the line. Works in a PlayerChatEvent or a PrivateMessageEvent handler; the restriction applies to that one message only and ends when the dispatch is over. A second call replaces the list. An empty list means nobody gets the line. Offline handles are left out.

Parameters

Name Type Description
recipients IEnumerable<Player> The players who get the message (at most 4096).

Returns int: The number of distinct recipients kept; -1 when no PlayerChat or PrivateMessage handler is running, or when the engine refuses the list.

Throws

  • System.ArgumentException: More than 4096 recipients. Nothing is sent to the engine.

Player