Ability
How to use the basic Ability interface
The Ability Key
All custom Origins-Reborn abilities need to implement the Ability
interface, or another interface that extends it.
It has a single, basic method that must be implemented, getKey
- this returns the key that is used to give your custom ability to an origin.
Example:
This will give your ability the key my_cool_addon:my_ability
Ability Checks
Next, to run a piece of code dependant on whether a player has an ability, you can use the runForAbility
method like this:
This means any player who jumps with the ability will take damage, and receive the message "You took damage!" in chat.
You can also use the method hasAbility
to check if a player has an ability, returning a boolean value, e.g.
boolean player_has_power = hasAbility(event.getPlayer())
Last updated
Was this helpful?