Custom Abilities: Triggers - BoBoBalloon/InnovativeItemsDOCS GitHub Wiki
Intro
Abilities are powerful tools, but depending on what you as a server owner are looking for, some options may be better than others. Because of this, all abilities must have a trigger field, without it, the ability will fail to load. Triggers tell the interpreter what event in the game it should listen for to fire the ability and feed in the corresponding information so the keywords can use the provided info.
Example
Provided below is an example of an ability with the trigger of right click:
test-ability:
trigger: 'right-click'
keywords:
- 'damage(?player, 1)'
To elaborate, this ability named test-ability would only fire when the player would right click the air with this item in their hand or off-hand. Once it fires, it would damage the player for half a heart.
List of Native Triggers
Below is a list of all built-in triggers that you may reference while writing new abilities:
(Remember, this is an incomplete list and triggers can be removed and added at any time)
Trigger | Description | Valid Targeters |
---|---|---|
right-click | When the player right clicks anything | ?player |
left-click | When the player left clicks anything | ?player |
right-click-block | When the player right clicks a block | ?player ?block |
left-click-block | When the player left clicks a block | ?player ?block |
damage-dealt | When the player deals damage | ?player ?entity |
damage-taken | When the player takes damage from an entity | ?player ?entity |
item-consume | When the player eats an item (like an apple or potion) | ?player |
timer:{tick delay} | Will trigger on a timer with a delay of the provided integer | ?player |
block-break | When the player breaks a block with the item in their main hand | ?player ?block |
none | This trigger will never fire naturally (meant for the innovative items execute command) | ?player |
crouch | When the player starts crouching/sneaking | ?player |
right-click-entity | When the player right clicks an entity while wearing or holding the item | ?player ?entity |
arrow-hit-entity | When the player fires a projectile and hits an entity | ?player ?entity |
arrow-hit-block | When the player fires a projectile and hits a block | ?player ?block |
double-left-click | When the player left clicks anything twice in half a second | ?player |
double-right-click | When the player right clicks anything twice in half a second | ?player |