Architecture
All listeners in Runway:- Extend
AbstractListener, which extends PacketEvents’SimplePacketListenerAbstract - Use
PacketListenerPriority.NORMALpriority - Have access to
ProcessHandlerfor text formatting and placeholder resolution - Can be individually enabled/disabled via configuration
Base Class Structure
Registration
Listeners are registered in the plugin’sonEnable() method using PacketEvents’ EventManager:
Available Listeners
System Chat
Intercepts chat messages and system notifications
Tablist
Formats player list headers and footers
Title
Handles title and subtitle text formatting
Inventory
Formats inventory titles and item display
Scoreboard
Processes scoreboard objective and score text
Item
Formats individual item names and lore
How Listeners Work
- Packet Interception: PacketEvents captures outgoing server packets before they’re sent to the client
- Type Checking: Each listener checks if the packet type matches what it handles
- Config Validation: Verifies the listener is enabled in the configuration
- Processing: Extracts text components and passes them to
ProcessHandler - Modification: Updates the packet with formatted text
- Transmission: The modified packet is sent to the client
PacketEvents Integration
Runway initializes PacketEvents during the plugin load phase:Key Settings
- reEncodeByDefault(true): Ensures packet modifications are properly encoded
- bStats(false): Disables metrics collection
- checkForUpdates(false): Disables update checking
Common Patterns
All listeners follow this pattern:Performance Considerations
- Listeners use early returns to avoid unnecessary processing
- Config checks happen before packet deserialization
- Text processing is only applied when listeners are enabled
- PacketEvents handles packet re-encoding efficiently