Class Perk
- java.lang.Object
-
- org.kikikan.deadbymoonlight.Configurable
-
- org.kikikan.deadbymoonlight.perks.Perk
-
- All Implemented Interfaces:
java.lang.Comparable<Configurable>
- Direct Known Subclasses:
CooldownPerk
,PassivePerk
,TokenPerk
public abstract class Perk extends Configurable
Represents the core of a Perk.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract int
amountOfTotemsRequired()
Determines how many Totems will be assigned to this TotemPerk at the start of the Trial.boolean
equals(java.lang.Object obj)
java.lang.String
getDescription()
The description of the Configurable, which will appear when the player hovers their cursor on the chat.protected org.bukkit.inventory.ItemStack
getDisplayItemStack()
Gets the ItemStack that represents this Perk in the Player's inventory.java.lang.String
getDisplayName()
The name that will be shown to playersprotected java.lang.String
getFileName()
Gets the name of the config file.java.util.List<java.lang.String>
getPerkDescription()
The description of the Perk, which appears when either the ItemStack or the Chat Text is hovered over by the Player's cursor.java.lang.String
getPerkDescriptionForChat()
Creates the Perk Description for the Chat.org.bukkit.inventory.ItemStack
getPerkItem()
Gets the Enchanted Book Item, which explains what this Perk does.protected PerkUser
getPerkUser()
Gets the PerkUser who has this instance of this Perk.int
hashCode()
void
init()
Initializes the Perk.abstract boolean
isKiller()
Determines whether this Perk will appear in the Killers' Perk List.abstract boolean
isSurvivor()
Determines whether this Perk will appear in the Survivors' Perk List.protected void
setDisplayItemStack(org.bukkit.inventory.ItemStack displayItemStack)
Sets the ItemStack that represents this Perk in the Player's Inventory.void
setDisplayStatus(boolean value)
Changes the Perk Display to the current state of the perkprotected void
setupPerk()
Created for the other abstract Perk classes.protected void
setupPerkDisplay()
Creates the Perk Display book item, and then gives it to the player when the Match starts.java.lang.String
toString()
-
Methods inherited from class org.kikikan.deadbymoonlight.Configurable
compareTo, getAllValuesFromConfig, getDefaultEnabled, getFormattedName, getName, getPlugin, getRequirements, getValueFromConfig, isEnabled, toTextComponent
-
-
-
-
Constructor Detail
-
Perk
public Perk(org.bukkit.plugin.java.JavaPlugin plugin, PerkUser perkUser)
The only constructor your Perk should have. Even if it is a subclass ofExhaustionPerk
orCooldownPerk
. This is the only constructor that Dead by Moonlight will attempt to call. Missing this constructor, your Perk will not work and an exception will be thrown.- Parameters:
plugin
- Your plugin's main class. Must never be null.perkUser
- The PerkUser that will use the Perk. (If the Perk is constructed for the Perk List,perkUser
will be null.)
-
-
Method Detail
-
getPerkUser
protected final PerkUser getPerkUser()
Gets the PerkUser who has this instance of this Perk.- Returns:
- The PerkUser using this instance of this Perk.
-
getDisplayItemStack
protected final org.bukkit.inventory.ItemStack getDisplayItemStack()
Gets the ItemStack that represents this Perk in the Player's inventory.- Returns:
- The ItemStack displaying this Perk in the Player's inventory.
-
setDisplayItemStack
protected final void setDisplayItemStack(org.bukkit.inventory.ItemStack displayItemStack)
Sets the ItemStack that represents this Perk in the Player's Inventory.- Parameters:
displayItemStack
- The new ItemStack which will hopefully give the Player information about this Perk.
-
setupPerkDisplay
protected final void setupPerkDisplay()
Creates the Perk Display book item, and then gives it to the player when the Match starts.
-
setDisplayStatus
public final void setDisplayStatus(boolean value)
Changes the Perk Display to the current state of the perk- Parameters:
value
- Is the Perk active, or inactive
-
isKiller
public abstract boolean isKiller()
Determines whether this Perk will appear in the Killers' Perk List.- Returns:
- True if it is shown in the Killers' Perk List
-
isSurvivor
public abstract boolean isSurvivor()
Determines whether this Perk will appear in the Survivors' Perk List. If the Perk implements TotemPerk, it will not appear in the Survivors' Perk List no matter what.- Returns:
- True if it is shown in the Survivors' Perk List
-
amountOfTotemsRequired
public abstract int amountOfTotemsRequired()
Determines how many Totems will be assigned to this TotemPerk at the start of the Trial. This function will only be called if the PerkUser equipping this Perk is the Killer.- Returns:
- The amount of Totems needed for this Perk.
-
init
public final void init()
Initializes the Perk. Called from PerkUser when the game is about to start.
-
setupPerk
protected void setupPerk()
Created for the other abstract Perk classes. Gets called just beforeonStart()
.
-
getPerkDescription
public final java.util.List<java.lang.String> getPerkDescription()
The description of the Perk, which appears when either the ItemStack or the Chat Text is hovered over by the Player's cursor.- Returns:
- The description of the Perk
-
getDisplayName
public final java.lang.String getDisplayName()
Description copied from class:Configurable
The name that will be shown to players- Specified by:
getDisplayName
in classConfigurable
- Returns:
- The (translated) name that will be shown to players
-
getPerkDescriptionForChat
public final java.lang.String getPerkDescriptionForChat()
Creates the Perk Description for the Chat.- Returns:
- The Perk Description in a single String.
-
getPerkItem
public final org.bukkit.inventory.ItemStack getPerkItem()
Gets the Enchanted Book Item, which explains what this Perk does. Visible in the Perk List.- Returns:
- The Information Book Item.
-
getFileName
protected final java.lang.String getFileName()
Description copied from class:Configurable
Gets the name of the config file.- Specified by:
getFileName
in classConfigurable
- Returns:
- The name of the config file.
-
getDescription
public final java.lang.String getDescription()
Description copied from class:Configurable
The description of the Configurable, which will appear when the player hovers their cursor on the chat.- Specified by:
getDescription
in classConfigurable
- Returns:
- An informative description
-
toString
public final java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public final boolean equals(java.lang.Object obj)
- Overrides:
equals
in classConfigurable
-
hashCode
public final int hashCode()
- Overrides:
hashCode
in classConfigurable
-
-