Class PlayerSkill

java.lang.Object
studio.magemonkey.fabled.api.player.PlayerSkill

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

    Constructors
    Constructor
    Description
    PlayerSkill(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 Type
    Method
    Description
    void
    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
    Retrieves the material this skill is currently bound to.
    long
     
    int
    Gets the current cooldown of the skill in seconds.
    int
    Retrieves the cost to upgrade the skill to the next level
    Retrieves the template data for this skill.
    int
     
    int
    Retrieves the current level the player has the skill at
    int
    Retrieves the level requirement of the skill to get to the next level
    double
     
    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 plugin
    boolean
    Checks whether the skill is at its maximum level
    boolean
    Checks whether the skill is currently on cooldown
    boolean
    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
    Reverts the skill back to level 0, locking it from casting and refunding invested skill points
    void
    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 skill
    void
    Starts the skill preview effects
    void
    subtractCooldown(double seconds)
    Subtracts from the current cooldown time, shortening the time until it can be cast again.

    Methods inherited from class java.lang.Object

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

    • PlayerSkill

      public PlayerSkill(PlayerData player, Skill skill, PlayerClass parent)
      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 data
      skill - skill template
      parent - owning player class
    • PlayerSkill

      public PlayerSkill(PlayerData player, Skill skill, PlayerClass parent, boolean external)
      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 data
      skill - skill template
      parent - owning player class
      external - 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

      public Skill getData()
      Retrieves the template data for this skill.
      Returns:
      skill template data
    • getPlayerClass

      public PlayerClass getPlayerClass()
      Retrieves the owning player class.
      Returns:
      owning player class
    • getPlayerData

      public PlayerData 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

      public SkillStatus 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 public void setBind(org.bukkit.Material mat)
      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