Custom Abilities: Cooldowns - BoBoBalloon/InnovativeItemsDOCS GitHub Wiki

Intro

When making an ability, it may be a bit too powerful to allow a player to constantly use it, this is where cooldowns come in. Cooldowns make sure a certain amount of time has passed before the ability can be used again. By default abilities do not have any cooldowns, so if you want one, you must explicitly tell the interpreter that you would like one.

Example

An example of an ability with a cooldown is provided below:

test-ability:
  trigger: 'right-click'
  cooldown: 20 #delay in ticks (seconds x 20)
  show-cooldown: '&4&lYou have {cooldown} time left to use this ability!' #an optional field that defaults to null, if explicitly stated it will send the player the provided message when the ability was attempted to be used but was still on cooldown. You can use the {cooldown} placeholder to get the current time left the player has to wait until the ability can be used again.
  show-cooldown-type: 'ACTION_BAR' #an optional field that is null when the show-cooldown field is not provided. If the show-cooldown is provided the field defaults to CHAT. This field determines how the text will be presented to the player.
  keywords:
    - 'message(?player, it has been at least one second since you last used this ability)'

You can find the list of options to the show-cooldown-type field here.