Overview
Theevent global provides an event system for intercepting and handling packets, connection events, and game events. All packet interception happens in real-time as data flows between the client and server.
Registering Event Handlers
Useevent.on() to register event handlers:
Available Events
Connection Events
Fired when the game client connects to the proxy
Fired when the game client disconnects from the proxy
Fired when the proxy connects to the game server
Fired when the proxy disconnects from the game server
Packet Events
Fired when a packet is sent from the server to the client
Fired when a packet is sent from the client to the server
Game Events
You can also listen for specific game packet events by name:Event Context
All event handlers receive a context object with these methods:Returns
true if the event has an associated packetParse and return the packet data. Alias for
ctx:parse_packet().Get the raw packet object
Get the raw packet bytes as a string
Cancel the packet (prevent it from being sent)
Examples
Intercepting Chat Messages
Modifying Packets
Tracking Player Spawns
Auto-Response System
Packet Statistics
Complex Packet Filtering
Best Practices
See Also
Packets API
Learn about sending packets
World API
Access world and player data