Class Ability

java.lang.Object
org.woftnw.eof.ability.Ability
Direct Known Subclasses:
ActiveAbility

public class Ability extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    protected static final AbilityEffect[]
     
    protected AbilityEffect[]
    The effects to apply to the user on activation.
    protected final org.bukkit.NamespacedKey
     
    protected net.kyori.adventure.text.TextComponent
    The display name of this ability.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Ability(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 Type
    Method
    Description
    void
    activate(org.bukkit.entity.Player player)
    Activate the ability.
    org.bukkit.NamespacedKey
     
    net.kyori.adventure.text.TextComponent
    Get the name of this ability.
    Get the name of this ability as a String.
    protected void
    notifyActivation(@NotNull org.bukkit.entity.Player player)
    Notify the player that the ability has been activated.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_EFFECTS

      protected static final AbilityEffect[] DEFAULT_EFFECTS
    • ID

      protected final org.bukkit.NamespacedKey ID
    • name

      protected net.kyori.adventure.text.TextComponent name
      The display name of this ability.
    • effects

      protected AbilityEffect[] 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

      public void activate(org.bukkit.entity.Player player) throws AbilityActivationException
      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

      public String getNameAsString()
      Get the name of this ability as a String.
      Returns:
      The ability name as a String.