Module
extends
EventHandler
in
Classes which provide module functionality should implement this interface.
Table of Contents
- handleEvent() : EventContext
- Called when an event is published that is handled by this class.
- onRegister() : mixed
- Lifecycle method called when this module is initially installed. Use this method to perform one-time setup operations like adding tables to the database.
- onUnregister() : mixed
- Lifecycle method called when this module is uninstalled. Use this method to tear down any module-specific additions, like database tables added during registration.
Methods
handleEvent()
Called when an event is published that is handled by this class.
public
static handleEvent(Game $g, EventContext $context) : EventContext
Parameters
- $g : Game
-
The game.
- $context : EventContext
-
Arbitrary dictionary representing context around this event.
Return values
EventContext —Return an array if you want to make changes to the $context before the next handler is called. Otherwise, return null. Any changes made will be propogated to the event publisher as well.
onRegister()
Lifecycle method called when this module is initially installed. Use this method to perform one-time setup operations like adding tables to the database.
public
static onRegister(Game $g, Module $module) : mixed
Parameters
Return values
mixed —onUnregister()
Lifecycle method called when this module is uninstalled. Use this method to tear down any module-specific additions, like database tables added during registration.
public
static onUnregister(Game $g, Module $module) : mixed