Class PlayerSkillBar

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

public class PlayerSkillBar extends Object
A skill bar for a player
  • Constructor Summary

    Constructors
    Constructor
    Description
    Initial constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    apply(int slot)
    Applies an action for the item slot
    void
    Applies setting data to the skill bar, applying locked slots if they aren't matching.
    void
    assign(PlayerSkill skill, int slot)
    Assigns the skill to the slot
    void
    clear(org.bukkit.entity.Player player)
    Clears the skill bar icons for the player
    void
    clear(org.bukkit.event.entity.PlayerDeathEvent event)
    Clears the skill bar icons for the player and prevents them from dropping on death
    int
    Counts the number of open slots in the player's inventory besides skill slots
    Retrieves the data for the skill bar.
    int
    Retrieves the slot for the first weapon slot
    int
    Counts the item in the owning player's inventory in the skill slots
    org.bukkit.entity.Player
     
    Retrieves the owner of the skill bar represented as a VersionPlayer
    boolean
     
    boolean
    whether the skill bar has been set up recently
    boolean
    isWeaponSlot(int slot)
    Checks if the slot is the weapon slot for the player
    void
    reserve(int slot)
     
    void
    Resets the skill bar
    void
    setup(org.bukkit.entity.HumanEntity player)
    Sets up the player for the skill bar
    void
    Toggles the enabled state of the skill bar
    void
    toggleSlot(int slot)
    Toggles a slot between weapon and skill
    void
    Adds an unlocked skill to the skill bar
    void
    update(org.bukkit.entity.HumanEntity player)
    Updates the player's skill bar icons
    void
    Updates the displayed cooldown for the skill bar

    Methods inherited from class java.lang.Object

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

    • PlayerSkillBar

      public PlayerSkillBar(PlayerData player)
      Initial constructor
      Parameters:
      player - owning player data
  • Method Details

    • reserve

      public void reserve(int slot)
    • getPlayerData

      public PlayerData getPlayerData()

      Retrieves the owner of the skill bar represented as a VersionPlayer

      Returns:
      VersionPlayer of the owner
    • getPlayer

      public org.bukkit.entity.Player getPlayer()
      Returns:
      name of the player owning the skill bar
    • getFirstWeaponSlot

      public int getFirstWeaponSlot()
      Retrieves the slot for the first weapon slot
      Returns:
      first weapon slot
    • getItemsInSkillSlots

      public int getItemsInSkillSlots()

      Counts the item in the owning player's inventory in the skill slots

      If the player is offline, this returns -1

      Returns:
      number of items in the skill slots
    • countOpenSlots

      public int countOpenSlots()

      Counts the number of open slots in the player's inventory besides skill slots

      This returns -1 if the player is offline

      Returns:
      open slots in the players inventory
    • toggleEnabled

      public void toggleEnabled()
      Toggles the enabled state of the skill bar
    • toggleSlot

      public void toggleSlot(int slot)
      Toggles a slot between weapon and skill
      Parameters:
      slot - slot to toggle
    • apply

      public void apply(int slot)
      Applies an action for the item slot
      Parameters:
      slot - slot to apply to
    • clear

      public void clear(org.bukkit.entity.Player player)
      Clears the skill bar icons for the player
      Parameters:
      player - player to clear for
    • clear

      public void clear(org.bukkit.event.entity.PlayerDeathEvent event)
      Clears the skill bar icons for the player and prevents them from dropping on death
      Parameters:
      event - death event of the player to clear for
    • reset

      public void reset()
      Resets the skill bar
    • setup

      public void setup(org.bukkit.entity.HumanEntity player)
      Sets up the player for the skill bar
      Parameters:
      player - player to set up for
    • unlock

      public void unlock(PlayerSkill skill)
      Adds an unlocked skill to the skill bar
      Parameters:
      skill - unlocked skill
    • assign

      public void assign(PlayerSkill skill, int slot)
      Assigns the skill to the slot
      Parameters:
      skill - skill to assign
      slot - slot to assign to
    • update

      public void update(org.bukkit.entity.HumanEntity player)
      Updates the player's skill bar icons
    • updateCooldowns

      public void updateCooldowns()
      Updates the displayed cooldown for the skill bar
    • isWeaponSlot

      public boolean isWeaponSlot(int slot)
      Checks if the slot is the weapon slot for the player
      Parameters:
      slot - slot to check
      Returns:
      true if weapon slot, false otherwise
    • getData

      public Map<Integer,String> getData()

      Retrieves the data for the skill bar.

      The key is the slot of the hotbar.

      The value is the skill assigned to the slot.

      Modifying this map will change the player's skill bar data.

      Returns:
      skill bar data
    • applySettings

      public void applySettings()
      Applies setting data to the skill bar, applying locked slots if they aren't matching.
    • isEnabled

      public boolean isEnabled()
      Returns:
      whether the skill bar is enabled
    • isSetup

      public boolean isSetup()
      whether the skill bar has been set up recently
      Returns:
      true if setup recently, false otherwise