Class InventoryTree

java.lang.Object
studio.magemonkey.fabled.tree.SkillTree
studio.magemonkey.fabled.tree.basic.InventoryTree
Direct Known Subclasses:
BasicHorizontalTree, BasicVerticalTree, CustomTree, FloodTree, LevelTree, RequirementTree

public abstract class InventoryTree extends SkillTree
A skill tree manager for classes
  • Field Details

    • comparator

      protected static final Comparator<Skill> comparator
      Comparator for skills for most trees
    • skillSlots

      protected final TreeMap<Integer,Skill> skillSlots
    • height

      protected int height
  • Constructor Details

    • InventoryTree

      public InventoryTree(Fabled api, FabledClass tree)
      Constructor
      Parameters:
      api - api reference
  • Method Details

    • show

      public void show(org.bukkit.entity.Player player)
      Shows the player the skill tree so they can view/manage their skills.
      Parameters:
      player - player to show
    • getInventory

      public org.bukkit.inventory.Inventory getInventory(PlayerData player)
      Generates a new skill tree inventory
      Parameters:
      player - player data to show
      Returns:
      skill tree inventory
    • checkClick

      public boolean checkClick(int slot)
      Checks a click for actions
      Parameters:
      slot - slot that was clicked
      Returns:
      whether the click should be cancelled (when it was a skill or link)
    • isSkill

      public boolean isSkill(org.bukkit.entity.HumanEntity player, int slot)
      Checks if the slot points to a skill
      Parameters:
      slot - slot to check
      Returns:
      true if a skill, false otherwise
    • getSkill

      public Skill getSkill(int slot)
      Gets the skill attached to a slot
      Parameters:
      slot - slot to retrieve for
      Returns:
      skill for the slot
    • getSkillSlots

      public TreeMap<Integer,Skill> getSkillSlots()
      Retrieves the entire map of occupied skill slots for the skill tree
      Returns:
      map of occupied skill slots
    • getHeight

      public int getHeight()
    • arrange

      public void arrange() throws SkillTreeException
      Arranges the skill tree
      Overrides:
      arrange in class SkillTree
      Throws:
      SkillTreeException
    • update

      public void update(PlayerData player)
      Updates a skill in the view
      Parameters:
      player - player
    • hasSkill

      public boolean hasSkill(Skill skill)
      Checks if the class has the skill registered
      Specified by:
      hasSkill in class SkillTree
      Parameters:
      skill - skill to check
      Returns:
      true if registered, false otherwise