Class PlayerSkillBar
java.lang.Object
studio.magemonkey.fabled.api.player.PlayerSkillBar
A skill bar for a player
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(int slot) Applies an action for the item slotvoidApplies setting data to the skill bar, applying locked slots if they aren't matching.voidassign(PlayerSkill skill, int slot) Assigns the skill to the slotvoidclear(org.bukkit.entity.Player player) Clears the skill bar icons for the playervoidclear(org.bukkit.event.entity.PlayerDeathEvent event) Clears the skill bar icons for the player and prevents them from dropping on deathintCounts the number of open slots in the player's inventory besides skill slotsgetData()Retrieves the data for the skill bar.intRetrieves the slot for the first weapon slotintCounts the item in the owning player's inventory in the skill slotsorg.bukkit.entity.PlayerRetrieves the owner of the skill bar represented as a VersionPlayerbooleanbooleanisSetup()whether the skill bar has been set up recentlybooleanisWeaponSlot(int slot) Checks if the slot is the weapon slot for the playervoidreserve(int slot) voidreset()Resets the skill barvoidsetup(org.bukkit.entity.HumanEntity player) Sets up the player for the skill barvoidToggles the enabled state of the skill barvoidtoggleSlot(int slot) Toggles a slot between weapon and skillvoidunlock(PlayerSkill skill) Adds an unlocked skill to the skill barvoidupdate(org.bukkit.entity.HumanEntity player) Updates the player's skill bar iconsvoidUpdates 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
-