Class PlayerSkill
java.lang.Object
studio.magemonkey.fabled.api.player.PlayerSkill
Represents player-specific data for a skill such as the player's
current level for the skill, the cooldown, and other related data.
-
Constructor Summary
ConstructorsConstructorDescriptionPlayerSkill
(PlayerData player, Skill skill, PlayerClass parent) Constructs a new PlayerSkill.PlayerSkill
(PlayerData player, Skill skill, PlayerClass parent, boolean external) Constructs a new PlayerSkill. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCooldown
(double seconds) Adds to the current cooldown time, lengthening the time until it can be cast again.void
addLevels
(int amount) Adds levels to the skill.org.bukkit.Material
getBind()
Retrieves the material this skill is currently bound to.long
int
Gets the current cooldown of the skill in seconds.int
getCost()
Retrieves the cost to upgrade the skill to the next levelgetData()
Retrieves the template data for this skill.int
int
getLevel()
Retrieves the current level the player has the skill atint
Retrieves the level requirement of the skill to get to the next leveldouble
Retrieves the owning player class.Retrieves the owning player's data.Retrieves the current ready status of the skill which could be on cooldown, missing mana, or ready.boolean
Retrieves whether the skill was added by an external pluginboolean
isMaxed()
Checks whether the skill is at its maximum levelboolean
Checks whether the skill is currently on cooldownboolean
Checks whether the skill is currently unlocked for the player.void
Refreshes the cooldown of the skill, allowing the player to cast the skill again.void
revert()
Reverts the skill back to level 0, locking it from casting and refunding invested skill pointsvoid
setBind
(org.bukkit.Material mat) Deprecated.void
setCooldown
(long cooldown) void
setLevel
(int level) Sets the level of the skill.void
Starts the cooldown of the skillvoid
Starts the skill preview effectsvoid
subtractCooldown
(double seconds) Subtracts from the current cooldown time, shortening the time until it can be cast again.
-
Constructor Details
-
PlayerSkill
Constructs a new PlayerSkill. You should not need to use this constructor as it is provided by the API. Get instances through the PlayerData object.- Parameters:
player
- owning player dataskill
- skill templateparent
- owning player class
-
PlayerSkill
Constructs a new PlayerSkill. You should not need to use this constructor as it is provided by the API. Get instances through the PlayerData object.- Parameters:
player
- owning player dataskill
- skill templateparent
- owning player classexternal
- whether the skill was added by an external plugin
-
-
Method Details
-
isUnlocked
public boolean isUnlocked()Checks whether the skill is currently unlocked for the player. This requires the skill to be at least level 1.- Returns:
- true if unlocked, false otherwise
-
getData
Retrieves the template data for this skill.- Returns:
- skill template data
-
getPlayerClass
Retrieves the owning player class.- Returns:
- owning player class
-
getPlayerData
Retrieves the owning player's data.- Returns:
- owning player's data
-
getBind
public org.bukkit.Material getBind()Retrieves the material this skill is currently bound to.- Returns:
- the current material bound to or null if not bound
-
getLevel
public int getLevel()Retrieves the current level the player has the skill at- Returns:
- current skill level
-
isExternal
public boolean isExternal()Retrieves whether the skill was added by an external plugin- Returns:
- whether the skill was added by an external plugin
-
getCost
public int getCost()Retrieves the cost to upgrade the skill to the next level- Returns:
- cost to upgrade the skill to the next level
-
getInvestedCost
public int getInvestedCost()- Returns:
- total invested cost in the skill
-
getManaCost
public double getManaCost()- Returns:
- mana cost to use the skill
-
getLevelReq
public int getLevelReq()Retrieves the level requirement of the skill to get to the next level- Returns:
- the level requirement to get to the next level
-
isOnCooldown
public boolean isOnCooldown()Checks whether the skill is currently on cooldown- Returns:
- true if on cooldown, false otherwise
-
isMaxed
public boolean isMaxed()Checks whether the skill is at its maximum level- Returns:
- true if at max level, false otherwise
-
getCooldownLeft
public int getCooldownLeft()Gets the current cooldown of the skill in seconds.- Returns:
- current cooldown in seconds or 0 if not on cooldown
-
getStatus
Retrieves the current ready status of the skill which could be on cooldown, missing mana, or ready.- Returns:
- the ready status of the skill
-
addLevels
public void addLevels(int amount) Adds levels to the skill. This will not update passive effects. To level up/down the skill properly, use the upgrade and downgrade methods in PlayerData.- Parameters:
amount
- number of levels to add
-
setBind
Deprecated.Sets the bind material of the skill- Parameters:
mat
- new bind material
-
revert
public void revert()Reverts the skill back to level 0, locking it from casting and refunding invested skill points -
startCooldown
public void startCooldown()Starts the cooldown of the skill -
refreshCooldown
public void refreshCooldown()Refreshes the cooldown of the skill, allowing the player to cast the skill again. -
subtractCooldown
public void subtractCooldown(double seconds) Subtracts from the current cooldown time, shortening the time until it can be cast again.- Parameters:
seconds
- number of seconds to subtract from the cooldown
-
addCooldown
public void addCooldown(double seconds) Adds to the current cooldown time, lengthening the time until it can be cast again.- Parameters:
seconds
- number of seconds to add to the cooldown
-
startPreview
public void startPreview()Starts the skill preview effects -
getCooldown
public long getCooldown() -
setCooldown
public void setCooldown(long cooldown) -
setLevel
public void setLevel(int level) Sets the level of the skill. This will not update passive effects. To level up/down the skill properly, use the upgrade and downgrade methods in PlayerData.- Parameters:
level
- new level of the skill
-