Events
Events in Commander are points during gameplay when your commands will be invoked.
Introduction to subscriptions
An event declaration in your subscription file is an identifier of the event you want to subscribe to. An event can accept additional parameters in the parameters
block, but built-in events do not require them (yet). Subscription files are read from commander/events
.
|- recipes
|- commander
|- events
|- test_event.json
|- folder
|- nested.json
|- tags
A typical event declaration might look something like this:
Example
json
{
"event": "commander:after_killed_by_other",
"commands": [
]
}
json
{
"event": "modid:custom_event",
"parameters": {
},
"commands": [
]
}
The subscription file can contain multiple subscriptions to different (or identical) events.
Example
json
{
"events": [
{
"event": "commander:after_killed_by_other"
},
{
"event": "commander:allow_damage"
},
{
"event": "commander:player_attack/block"
}
]
}
Built-in events
Commander wraps most compatible fabric events under the commander
namespace. "Return" here means the cancel command
Currently available events can be seen here: EntityEvents, PlayerEvents, ServerLifecycle, ServerTick