Add support for broadcasting messages with source information #6512
Labels
BC break
Breaks API compatibility
Category: API
Related to the plugin API
Category: Core
Related to internal functionality
Easy task
Probably really easy to do, good task for first-time contributors
Type: Enhancement
Contributes features or other improvements to PocketMine-MP
Milestone
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 fromsendMessage()
string $channelId
with a default tobroadcastMessage()
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
The text was updated successfully, but these errors were encountered: