Interface ItemManager


public interface ItemManager
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.inventory.ItemStack
    addModifier(org.bukkit.inventory.ItemStack item, ModifierType type, Stat stat, double value, boolean lore)
    Adds a modifier to an item, with optional lore.
    org.bukkit.inventory.ItemStack
    addMultiplier(org.bukkit.inventory.ItemStack item, ModifierType type, Skill skill, double value, boolean lore)
    Adds a multiplier to an item, with optional lore.
    org.bukkit.inventory.ItemStack
    addRequirement(org.bukkit.inventory.ItemStack item, ModifierType type, Skill skill, int level, boolean lore)
    Adds a skill requirement to use an item, with optional lore.
    getModifiers(org.bukkit.inventory.ItemStack item, ModifierType type)
    Gets a list of stat modifiers on an item for a given modifier type.
    getMultipliers(org.bukkit.inventory.ItemStack item, ModifierType type)
    Gets a list of skill multipliers on an item for a given modifier type.
    getRequirements(org.bukkit.inventory.ItemStack item, ModifierType type)
    Gets the skill requirements for an item.
    org.bukkit.inventory.ItemStack
    parseItem(org.spongepowered.configurate.ConfigurationNode config)
    Parses an ItemStack from a ConfigurationNode section in the same format used to parse items in default loot and menus.
    List<org.bukkit.inventory.ItemStack>
    parseMultipleItems(org.spongepowered.configurate.ConfigurationNode config)
    Parses a list of ItemStack from a ConfigurationNode if it has a materials list.
    boolean
    passesFilter(org.bukkit.inventory.ItemStack item, ItemFilter filter)
    Test whether a given ItemStack passes a source ItemFilter.
    org.bukkit.inventory.ItemStack
    removeModifier(org.bukkit.inventory.ItemStack item, ModifierType type, Stat stat)
    Removes a modifier from an item for a given modifier type and stat.
    org.bukkit.inventory.ItemStack
    removeMultiplier(org.bukkit.inventory.ItemStack item, ModifierType type, Skill skill)
    Removes a multiplier from an item for the given skill.
    org.bukkit.inventory.ItemStack
    removeRequirement(org.bukkit.inventory.ItemStack item, ModifierType type, Skill skill)
    Removes a skill requirement from an item.
  • Method Details

    • addModifier

      org.bukkit.inventory.ItemStack addModifier(org.bukkit.inventory.ItemStack item, ModifierType type, Stat stat, double value, boolean lore)
      Adds a modifier to an item, with optional lore. This does not change the item passed in directly, you must use the returned ItemStack. This means the original ItemStack passed in is not changed at all, a new one is created.
      Parameters:
      item - the original item, will not be changed by the method
      type - the ModifierType to add
      stat - the stat to add (Use Stats enum for default stats)
      value - the value of the stat to add
      lore - whether to add lore
      Returns:
      a new ItemStack with the modifier
    • getModifiers

      List<StatModifier> getModifiers(org.bukkit.inventory.ItemStack item, ModifierType type)
      Gets a list of stat modifiers on an item for a given modifier type.
      Parameters:
      item - the item to get the modifiers of
      type - the modifier type
      Returns:
      a list of modifiers
    • removeModifier

      org.bukkit.inventory.ItemStack removeModifier(org.bukkit.inventory.ItemStack item, ModifierType type, Stat stat)
      Removes a modifier from an item for a given modifier type and stat. Does not modify the ItemStack passed in, instead returns a copy of the item with the modifier removed. Will not remove any lore.
      Parameters:
      item - The item to remove the modifier from. Does not get modified.
      type - the modifier type
      stat - the stat of the modifier to remove
      Returns:
      the item with the modifier removed
    • addMultiplier

      org.bukkit.inventory.ItemStack addMultiplier(org.bukkit.inventory.ItemStack item, ModifierType type, Skill skill, double value, boolean lore)
      Adds a multiplier to an item, with optional lore. This does not change the item passed in directly, you must use the returned ItemStack. This means the original ItemStack passed in is not changed at all, a new one is created.
      Parameters:
      item - the original item, will not be changed by the method
      type - the ModifierType to add
      skill - the skill to add (Use Skills enum for default skills)
      value - the value of the multiplier (in percentage points) to add
      lore - whether to add lore
      Returns:
      a new ItemStack with the multiplier
    • getMultipliers

      List<Multiplier> getMultipliers(org.bukkit.inventory.ItemStack item, ModifierType type)
      Gets a list of skill multipliers on an item for a given modifier type.
      Parameters:
      item - the item to get the multipliers of
      type - the modifier type
      Returns:
      a list of multipliers
    • removeMultiplier

      org.bukkit.inventory.ItemStack removeMultiplier(org.bukkit.inventory.ItemStack item, ModifierType type, Skill skill)
      Removes a multiplier from an item for the given skill. Does not modify the item, instead returns a copy with the multiplier removed. Will not remove any lore.
      Parameters:
      item - item to remove the multiplier from
      type - the type of modifier
      skill - the skill of the multiplier to remove, or null for global multipliers
      Returns:
      the modified item with the multiplier removed
    • addRequirement

      org.bukkit.inventory.ItemStack addRequirement(org.bukkit.inventory.ItemStack item, ModifierType type, Skill skill, int level, boolean lore)
      Adds a skill requirement to use an item, with optional lore. This does not change the item passed in directly, you must use the returned ItemStack. This means the original ItemStack passed in is not changed at all, a new one is created.
      Parameters:
      item - the original item, will not be changed by the method
      type - the ModifierType to add
      skill - the skill the requirement is for (Use Skills enum for default skills)
      level - the skill level required to use the item
      lore - whether to add lore
      Returns:
      a new ItemStack with the requirement
    • getRequirements

      Map<Skill,Integer> getRequirements(org.bukkit.inventory.ItemStack item, ModifierType type)
      Gets the skill requirements for an item.
      Parameters:
      item - the item to get the requirements of
      type - the modifier type
      Returns:
      a map of skill requirements, where the key is the skill and the level requirements is the value
    • removeRequirement

      org.bukkit.inventory.ItemStack removeRequirement(org.bukkit.inventory.ItemStack item, ModifierType type, Skill skill)
      Removes a skill requirement from an item. Does not modify the item, instead returns a copy of the item with the requirement removed. Does not modify lore.
      Parameters:
      item - the item to remove the requirement from
      type - the modifier type
      skill - the skill of the requirement to remove
      Returns:
      the modified item with the requirement removed
    • passesFilter

      boolean passesFilter(org.bukkit.inventory.ItemStack item, ItemFilter filter)
      Test whether a given ItemStack passes a source ItemFilter. Used to implement the leveler of a CustomSource with an ItemFilter field.
      Parameters:
      item - the item to test
      filter - the filter to test with
      Returns:
      whether the item passes the filter
    • parseItem

      org.bukkit.inventory.ItemStack parseItem(org.spongepowered.configurate.ConfigurationNode config)
      Parses an ItemStack from a ConfigurationNode section in the same format used to parse items in default loot and menus.
      Parameters:
      config - the Configurate ConfigurationNode to parse keys from, should be a mapping
      Returns:
      the parsed ItemStack
    • parseMultipleItems

      List<org.bukkit.inventory.ItemStack> parseMultipleItems(org.spongepowered.configurate.ConfigurationNode config)
      Parses a list of ItemStack from a ConfigurationNode if it has a materials list. Only the material differs between each item, the amount and all meta remains the same across items. If a regular material string is defined, a single item will be parsed like parseItem(ConfigurationNode) and the list returned will be of size 1.
      Parameters:
      config - the Configurate ConfigurationNode to parse keys from, should be a mapping
      Returns:
      a list of parsed ItemStack