Interface ItemStackSupport


  • public interface ItemStackSupport
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      org.bukkit.inventory.ItemStack addTag​(org.bukkit.inventory.ItemStack itemStack, String key, String value)
      Add NBT tag.
      org.bukkit.inventory.ItemStack applyPlayerSkinOnHead​(org.bukkit.entity.Player player, org.bukkit.inventory.ItemStack copyTagFrom)
      Apply player skin on a head.
      org.bukkit.inventory.ItemStack applySkinTextureOnHead​(String texture, org.bukkit.inventory.ItemStack itemStack)
      Apply skin texture on a head.
      org.bukkit.inventory.ItemStack createItem​(String material, int amount, byte data)
      Create an item stack.
      org.bukkit.inventory.ItemStack createItem​(org.bukkit.Material material, int amount, byte data)
      Create an item stack.
      double getDamage​(org.bukkit.inventory.ItemStack itemStack)
      Retrieve how much damage does an item do.
      org.bukkit.inventory.ItemStack getInHand​(org.bukkit.entity.Player player)
      Get the item in hand.
      org.bukkit.inventory.ItemStack getInOffHand​(org.bukkit.entity.Player player)
      Get the item from off hand.
      default byte getItemData​(org.bukkit.inventory.ItemStack itemStack)
      Get item data.
      String getTag​(org.bukkit.inventory.ItemStack itemStack, String key)
      Get a NBT tag from target item.
      boolean hasTag​(org.bukkit.inventory.ItemStack itemStack, String key)
      Check if the item has the given NBT tag.
      boolean isArmor​(org.bukkit.inventory.ItemStack itemStack)
      Check if the given item stack is an armor part.
      boolean isAxe​(org.bukkit.inventory.ItemStack itemStack)
      Check if the given item is an axe.
      boolean isBow​(org.bukkit.inventory.ItemStack itemStack)
      Check if the given item is a bow.
      boolean isPlayerHead​(org.bukkit.inventory.ItemStack itemStack)
      Check if the given item is a player head.
      boolean isProjectile​(org.bukkit.inventory.ItemStack itemStack)
      Check if the given item is a projectile.
      boolean isSword​(org.bukkit.inventory.ItemStack itemStack)
      Check if the given item stack is a sword.
      boolean isTool​(org.bukkit.inventory.ItemStack itemStack)
      Check if the given item stack is a tool.
      void minusAmount​(org.bukkit.entity.Player p, org.bukkit.inventory.ItemStack i, int amount)
      Use you own system to check if the player has enough in his inventory.
      org.bukkit.inventory.ItemStack removeTag​(org.bukkit.inventory.ItemStack itemStack, String key)
      Remote a NBT tag from an item stack.
      void setUnbreakable​(org.bukkit.inventory.ItemStack itemStack, boolean unbreakable)
      Make an item unbreakable.
    • Method Detail

      • getInHand

        @Nullable
        org.bukkit.inventory.ItemStack getInHand​(org.bukkit.entity.Player player)
        Get the item in hand.
        Parameters:
        player - target player.
        Returns:
        the item from given player's main hand.
      • getInOffHand

        @Nullable
        org.bukkit.inventory.ItemStack getInOffHand​(org.bukkit.entity.Player player)
        Get the item from off hand. Always null on 1.8.
        Parameters:
        player - target player.
        Returns:
        the item from given player's off hand.
      • createItem

        @Nullable
        org.bukkit.inventory.ItemStack createItem​(String material,
                                                  int amount,
                                                  byte data)
        Create an item stack.
        Parameters:
        material - material
        amount - amount.
        data - item data.
        Returns:
        the created itemStack. Null if the given material is invalid.
      • createItem

        org.bukkit.inventory.ItemStack createItem​(org.bukkit.Material material,
                                                  int amount,
                                                  byte data)
        Create an item stack.
        Parameters:
        material - material
        amount - amount.
        data - item data.
        Returns:
        the created itemStack.
      • addTag

        org.bukkit.inventory.ItemStack addTag​(org.bukkit.inventory.ItemStack itemStack,
                                              String key,
                                              String value)
        Add NBT tag.
        Parameters:
        itemStack - target item stack.
        key - tag key.
        value - tag value.
        Returns:
        the modified item.
      • hasTag

        boolean hasTag​(org.bukkit.inventory.ItemStack itemStack,
                       String key)
        Check if the item has the given NBT tag.
        Parameters:
        key - target key.
        itemStack - target item stack.
        Returns:
        true if the item have a tag with given key.
      • getTag

        @Nullable
        String getTag​(org.bukkit.inventory.ItemStack itemStack,
                      String key)
        Get a NBT tag from target item.
        Parameters:
        itemStack - target item stack.
        key - tag key.
        Returns:
        given key value. Null if tag not exist.
      • removeTag

        org.bukkit.inventory.ItemStack removeTag​(org.bukkit.inventory.ItemStack itemStack,
                                                 String key)
        Remote a NBT tag from an item stack.
        Parameters:
        key - tag key to be removed.
        itemStack - target item.
        Returns:
        modified item stack.
      • setUnbreakable

        void setUnbreakable​(org.bukkit.inventory.ItemStack itemStack,
                            boolean unbreakable)
        Make an item unbreakable.
        Parameters:
        itemStack - target item.
        unbreakable - true or false.
      • minusAmount

        void minusAmount​(org.bukkit.entity.Player p,
                         org.bukkit.inventory.ItemStack i,
                         int amount)
        Use you own system to check if the player has enough in his inventory.
        Parameters:
        i - target item.
        p - target player.
        amount - amount to be removed.
      • getDamage

        double getDamage​(org.bukkit.inventory.ItemStack itemStack)
        Retrieve how much damage does an item do.
        Parameters:
        itemStack - target item.
        Returns:
        how much damage gives target item.
      • isArmor

        boolean isArmor​(org.bukkit.inventory.ItemStack itemStack)
        Check if the given item stack is an armor part.
        Parameters:
        itemStack - target item.
        Returns:
        true if it is armor.
      • isTool

        boolean isTool​(org.bukkit.inventory.ItemStack itemStack)
        Check if the given item stack is a tool.
        Parameters:
        itemStack - target item.
        Returns:
        true if it is a tool.
      • isSword

        boolean isSword​(org.bukkit.inventory.ItemStack itemStack)
        Check if the given item stack is a sword.
        Parameters:
        itemStack - target item.
        Returns:
        true if it is a sword.
      • isAxe

        boolean isAxe​(org.bukkit.inventory.ItemStack itemStack)
        Check if the given item is an axe.
        Parameters:
        itemStack - target item.
        Returns:
        true if it is an axe.
      • isBow

        boolean isBow​(org.bukkit.inventory.ItemStack itemStack)
        Check if the given item is a bow.
        Parameters:
        itemStack - target item.
        Returns:
        true if it is a bow.
      • isProjectile

        boolean isProjectile​(org.bukkit.inventory.ItemStack itemStack)
        Check if the given item is a projectile.
        Parameters:
        itemStack - target item.
        Returns:
        true if is a projectile.
      • isPlayerHead

        boolean isPlayerHead​(org.bukkit.inventory.ItemStack itemStack)
        Check if the given item is a player head.
        Parameters:
        itemStack - item to be checked.
        Returns:
        true if is a player head.
      • applyPlayerSkinOnHead

        org.bukkit.inventory.ItemStack applyPlayerSkinOnHead​(org.bukkit.entity.Player player,
                                                             org.bukkit.inventory.ItemStack copyTagFrom)
        Apply player skin on a head.
        Parameters:
        player - player skin owner.
        copyTagFrom - item to copy NBTTags from. Nullable.
        Returns:
        player head with player's skin.
      • applySkinTextureOnHead

        org.bukkit.inventory.ItemStack applySkinTextureOnHead​(String texture,
                                                              org.bukkit.inventory.ItemStack itemStack)
        Apply skin texture on a head.
        Parameters:
        texture - texture URI. The part after 'textures.minecraft.net/texture/'. You can get textures from minecraft-heads.com.
        itemStack - item to copy NBTTags from. Nullable.
        Returns:
        player head with given skin.
      • getItemData

        default byte getItemData​(org.bukkit.inventory.ItemStack itemStack)
        Get item data. Will always return 0 for 1.13+.