Class PlayerSkillBar
java.lang.Object
studio.magemonkey.fabled.api.player.PlayerSkillBar
A skill bar for a player
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
apply
(int slot) Applies an action for the item slotvoid
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 slotvoid
clear
(org.bukkit.entity.Player player) Clears the skill bar icons for the playervoid
clear
(org.bukkit.event.entity.PlayerDeathEvent event) Clears the skill bar icons for the player and prevents them from dropping on deathint
Counts the number of open slots in the player's inventory besides skill slotsgetData()
Retrieves the data for the skill bar.int
Retrieves the slot for the first weapon slotint
Counts the item in the owning player's inventory in the skill slotsorg.bukkit.entity.Player
Retrieves the owner of the skill bar represented as a VersionPlayerboolean
boolean
isSetup()
whether the skill bar has been set up recentlyboolean
isWeaponSlot
(int slot) Checks if the slot is the weapon slot for the playervoid
reserve
(int slot) void
reset()
Resets the skill barvoid
setup
(org.bukkit.entity.HumanEntity player) Sets up the player for the skill barvoid
Toggles the enabled state of the skill barvoid
toggleSlot
(int slot) Toggles a slot between weapon and skillvoid
unlock
(PlayerSkill skill) Adds an unlocked skill to the skill barvoid
update
(org.bukkit.entity.HumanEntity player) Updates the player's skill bar iconsvoid
Updates the displayed cooldown for the skill bar
-
Constructor Details
-
PlayerSkillBar
Initial constructor- Parameters:
player
- owning player data
-
-
Method Details
-
reserve
public void reserve(int slot) -
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
Adds an unlocked skill to the skill bar- Parameters:
skill
- unlocked skill
-
assign
Assigns the skill to the slot- Parameters:
skill
- skill to assignslot
- 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
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
-