Class CooldownPerk
- java.lang.Object
-
- org.kikikan.deadbymoonlight.Configurable
-
- org.kikikan.deadbymoonlight.perks.Perk
-
- org.kikikan.deadbymoonlight.perks.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 Summary
Constructors Constructor Description CooldownPerk(org.bukkit.plugin.java.JavaPlugin plugin, PerkUser perkUser, boolean isInverted)
The constructor for a Cooldown Perk
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.util.UUID
addRunnable(java.lang.Runnable runnable, org.kikikan.deadbymoonlight.util.TimerEventType type)
Registers a Runnable to run at the specified event.protected abstract int
getCooldownTime()
protected boolean
isTurnedOn()
Checks if the cooldown is turned on.protected void
off()
Turns off the cooldown.protected void
on()
Turns on the cooldown with the amount specified in the constructor.protected void
removeRunnable(java.util.UUID uuid)
Removes the specified runnable using its UUID that was generated when it was added.protected void
setupPerk()
Created for the other abstract Perk classes.-
Methods inherited from class org.kikikan.deadbymoonlight.perks.Perk
amountOfTotemsRequired, equals, getDescription, getDisplayItemStack, getDisplayName, getFileName, getPerkDescription, getPerkDescriptionForChat, getPerkItem, getPerkUser, hashCode, init, isKiller, isSurvivor, setDisplayItemStack, setDisplayStatus, setupPerkDisplay, toString
-
Methods inherited from class org.kikikan.deadbymoonlight.Configurable
compareTo, getAllValuesFromConfig, getDefaultEnabled, getFormattedName, getName, getPlugin, getRequirements, getValueFromConfig, isEnabled, toTextComponent
-
-
-
-
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 classperkUser
- 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 beforeonStart()
.
-
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 runtype
- 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()
-
-