SystemChatListener processes all system chat messages sent by the server, including player messages, announcements, and system notifications. It also handles action bar messages and filters unwanted notifications.
Packet Type
Intercepts:PacketType.Play.Server.SYSTEM_CHAT_MESSAGE
This packet is sent whenever the server needs to display a chat message to the player.
Configuration
Class Structure
Implementation Details
1. Packet Type Validation
- The listener is disabled in the configuration
- The packet type doesn’t match
SYSTEM_CHAT_MESSAGE
2. Message Extraction
Component to a MiniMessage string for processing.
3. Message Filtering
4. Action Bar Handling
[actionbar] tag are:
- Stripped of the tag
- Cancelled from appearing in chat
- Redirected to the action bar with formatting applied
5. Standard Message Processing
ProcessHandler.processComponent(), which:
- Resolves PlaceholderAPI placeholders
- Resolves MiniPlaceholders
- Parses MiniMessage formatting
- Returns a formatted Adventure
Component
Usage Example
When a plugin sends:- Detects the
[actionbar]tag - Removes the tag from the message
- Processes placeholders:
%player_name%→Steve - Applies MiniMessage gradient formatting
- Sends the result to the action bar instead of chat
Dependencies
- PacketEvents: For packet interception
- WrapperPlayServerSystemChatMessage: Packet wrapper for reading/modifying system chat
- MiniMessage: For serializing Adventure components to strings
- ProcessHandler: For placeholder resolution and formatting
Related Components
- ProcessHandler - Handles text processing
- ConfigManager - Manages listener configuration