Class CooldownPerk

  • All Implemented Interfaces:
    java.lang.Comparable<Configurable>
    Direct Known Subclasses:
    ExhaustionPerk

    public abstract class CooldownPerk
    extends Perk
    Represents a Perk that has a cooldown.
    • Constructor Detail

      • CooldownPerk

        public CooldownPerk​(org.bukkit.plugin.java.JavaPlugin plugin,
                            PerkUser perkUser,
                            boolean isInverted)
        The constructor for a Cooldown Perk
        Parameters:
        plugin - Your plugin's main class
        perkUser - The PerkUser that will use the Perk. (If the Perk is constructed for the Perk List, perkUser will be null.)
        isInverted - Defines the behaviour of the Display. If it is inverted, the Display will show that the Perk is active when the Cooldown is running/turned on, and the opposite if the Cooldown is inactive/turned off. Otherwise, (if it is not inverted) the Display will show that the Perk is active when the Cooldown is expired/turned off and the opposite if the Cooldown is running/turned on. This value is only for this "cosmetic" purpose.
    • Method Detail

      • on

        protected final void on()
        Turns on the cooldown with the amount specified in the constructor.
      • off

        protected final void off()
        Turns off the cooldown.
      • isTurnedOn

        protected final boolean isTurnedOn()
        Checks if the cooldown is turned on.
        Returns:
        True if the cooldown is turned on.
      • setupPerk

        protected void setupPerk()
        Description copied from class: Perk
        Created for the other abstract Perk classes. Gets called just before onStart().
        Overrides:
        setupPerk in class Perk
      • addRunnable

        protected final java.util.UUID addRunnable​(java.lang.Runnable runnable,
                                                   org.kikikan.deadbymoonlight.util.TimerEventType type)
        Registers a Runnable to run at the specified event.
        Parameters:
        runnable - Method to run
        type - When to run
        Returns:
        The generated UUID that you will have to use for identifying the Runnable.
        Throws:
        java.lang.IllegalStateException - If you try to call it before the Perk was initialized.
      • removeRunnable

        protected final void removeRunnable​(java.util.UUID uuid)
        Removes the specified runnable using its UUID that was generated when it was added.
        Parameters:
        uuid - The UUID which was generated when the Runnable was added.
        Throws:
        java.lang.IllegalStateException - If you try to call it before the Perk was initialized.
      • getCooldownTime

        protected abstract int getCooldownTime()