pmmp/PocketMine-MP

Add support for broadcasting messages with source information

dktapps opened this issue · 0 comments

Description

Currently, recipients of chat messages don't have a programmatic way to tell who caused the message to be sent, or why it was sent.

This issue proposes the following:

  • Server->broadcastMessageFrom(CommandSender $source, Translatable|string $message, ?array $recipients = null, string $channelId = <default>)
  • CommandSender->onMessageBroadcast(source, message, channelId) - probably best this is separate from sendMessage()
  • Add string $channelId with a default to broadcastMessage()

Adding a source allows recipients to react differently depending on who sent the message, and adding a channel allows recipients to understand what type of message it is (e.g. a command audit admin message should probably be treated differently than a chat message).

Implementing these features would enable passing source information to the client on chat messages, which would allow it to filter chat messages based on Xbox Live account blocks. This is a feature that is technically required by all featured servers, but has never been implemented.

Alternative methods