CommandEvent
Link to commandevent
The Command Event is fired whenever a command is executed. You can react to the command by providing a command handler. See Crafttweaker examples for an example.
Event Class
Link to event-class
You will need to cast the event in the function header as this class:
crafttweaker.event.CommandEvent
. It is advised to import the class
Copyimport crafttweaker.event.CommandEvent;
Event interface extensions
Link to event-interface-extensions
Command event implements the following interfaces:
ZenGetters/ZenSetters
Link to zengetterszensetters
The following information ca be retrieved/set during the event:
ZenGetter | ZenSetter | Type |
---|---|---|
ZenGetter commandSender | ZenSetter | Type ICommandSender |
ZenGetter command | ZenSetter | Type ICommand |
ZenGetter parameters | ZenSetter parameters | Type string[] |
ZenGetters/ZenSetters/ZenMethods from extensions
Link to zengetterszensetterszenmethods-from-extensions
The following information can be retrieved/set during the event:
ZenGetter | ZenSetter | Type |
---|---|---|
ZenGetter canceled | ZenSetter canceled | Type bool |
ZenMethods
event.cancel();
Method, returns void (nothing). Can cancel the event and stop something from happening