EventManager
Importing the class
If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.
import crafttweaker.api.events.EventManager;
Description
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.
Members
register(consumer as function(t as T) as void)
Registers a new event listener.script.zs
// ZenEventManager.register<T>(consumer as function(t as T) as void);myZenEventManager.register<T>(myConsumer);
Parameters:
consumer: function(t as T) as void
Type: function(t as T) as void
- The event handler. register(phase as ZenEventPhase, consumer as function(t as T) as void)
Registers a new event listener for the specified script.zs
ZenEventPhase
.myZenEventManager.register<T>(myZenEventPhase, myConsumer);
Parameters:
consumer: function(t as T) as void
Type: function(t as T) as void
- The event handler. register(listenToCanceled as bool, consumer as function(t as T) as void)
Registers a new event listener that can listen to cancelled events.script.zs
// ZenEventManager.register<T>(listenToCanceled as bool, consumer as function(t as T) as void);myZenEventManager.register<T>(myBool, myConsumer);
Parameters:
listenToCanceled: bool
Type: bool
- Whether cancelled events should also be listened to or not. consumer: function(t as T) as void
Type: function(t as T) as void
- The event handler. register(phase as ZenEventPhase, listenToCanceled as bool, consumer as function(t as T) as void)
Registers a new event listener for the specified script.zs
ZenEventPhase
that can listen to cancelled events.// ZenEventManager.register<T>(phase as EventPhase, listenToCanceled as bool, consumer as function(t as T) as void);myZenEventManager.register<T>(myZenEventPhase, myBool, myConsumer);
Parameters:
listenToCanceled: bool
Type: bool
- Whether cancelled events should also be listened to or not. consumer: function(t as T) as void
Type: function(t as T) as void
- The event handler.