Class Ability
java.lang.Object
org.woftnw.eof.ability.Ability
- Direct Known Subclasses:
ActiveAbility
Represents the simplest most generic form of an ability.
This class only provides the most basic attributes and behaviors of a tribal ability. If you're creating an ability,
you should extend a subclass of Ability like ActiveAbility.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final AbilityEffect[]protected AbilityEffect[]The effects to apply to the user on activation.protected final org.bukkit.NamespacedKeyprotected net.kyori.adventure.text.TextComponentThe display name of this ability. -
Constructor Summary
ConstructorsConstructorDescriptionAbility(org.bukkit.NamespacedKey id, net.kyori.adventure.text.TextComponent name) Create an empty ability.Ability(org.bukkit.NamespacedKey id, net.kyori.adventure.text.TextComponent name, AbilityEffect[] effects) Create an ability with some self effects. -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(org.bukkit.entity.Player player) Activate the ability.org.bukkit.NamespacedKeygetId()net.kyori.adventure.text.TextComponentgetName()Get the name of this ability.Get the name of this ability as a String.protected voidnotifyActivation(@NotNull org.bukkit.entity.Player player) Notify the player that the ability has been activated.
-
Field Details
-
DEFAULT_EFFECTS
-
ID
protected final org.bukkit.NamespacedKey ID -
name
protected net.kyori.adventure.text.TextComponent nameThe display name of this ability. -
effects
The effects to apply to the user on activation.
-
-
Constructor Details
-
Ability
public Ability(org.bukkit.NamespacedKey id, net.kyori.adventure.text.TextComponent name, AbilityEffect[] effects) Create an ability with some self effects.You probably want to use a subclass like
ActiveAbility. A generic Ability will not be of much use.- Parameters:
id- The unique ID of this ability.name- The display name of this ability.effects- The effects to apply on activation. May be empty.
-
Ability
public Ability(org.bukkit.NamespacedKey id, net.kyori.adventure.text.TextComponent name) Create an empty ability.You probably want to use a subclass like
ActiveAbility. A generic Ability will not be of much use.- Parameters:
id- The unique ID of this ability.name- The display name of this ability.
-
-
Method Details
-
activate
Activate the ability.- Parameters:
player- The player to activate this ability upon.- Throws:
AbilityActivationException- When an exception occurs that prevents the ability from being fully activated.
-
notifyActivation
protected void notifyActivation(@NotNull @NotNull org.bukkit.entity.Player player) Notify the player that the ability has been activated.- Parameters:
player- The player to notify.
-
getId
public org.bukkit.NamespacedKey getId() -
getName
public net.kyori.adventure.text.TextComponent getName()Get the name of this ability.- Returns:
- The ability name as a TextComponent.
-
getNameAsString
Get the name of this ability as a String.- Returns:
- The ability name as a String.
-