EventManager
Manages the registration and handling of custom handlers for the various events of the game.
You can register event handlers for pretty much everything, but make sure that the class you are referencing is documented as an event, otherwise you’re in for a nasty surprise.
Importing the class
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
Methods
Registers a new event listener.
Parameter | Type | Description |
---|---|---|
Parameter consumer | Type Consumer<T> | Description The event handler. |
Parameter T | Type Object | Description The type of the event. |
Registers a new event listener that can listen to cancelled events.
Parameter | Type | Description |
---|---|---|
Parameter listenToCanceled | Type boolean | Description Whether cancelled events should also be listened to or not. |
Parameter consumer | Type Consumer<T> | Description The event handler. |
Parameter T | Type Object | Description The type of the event. |
Registers a new event listener for the specified EventPhase.
Parameter | Type | Description |
---|---|---|
Parameter phase | Type EventPhase | Description The phase on which the event should be registered. |
Parameter consumer | Type Consumer<T> | Description The event handler. |
Parameter T | Type Object | Description The type of the event. |
Registers a new event listener for the specified EventPhase that can listen to cancelled events.
Parameter | Type | Description |
---|---|---|
Parameter phase | Type EventPhase | Description The phase on which the event should be registered. |
Parameter listenToCanceled | Type boolean | Description Whether cancelled events should also be listened to or not. |
Parameter consumer | Type Consumer<T> | Description The event handler. |
Parameter T | Type Object | Description The type of the event. |