Class Items


  • public class Items
    extends java.lang.Object
    A Utilities class for easy to manage Items
    • Field Detail

      • INVALID_ITEM

        public static final java.lang.String INVALID_ITEM
    • Constructor Detail

      • Items

        public Items​(org.bukkit.inventory.ItemStack stack)
        Instantiates a new Items.
        Parameters:
        stack - the stack
      • Items

        public Items​(java.lang.String string)
        Instantiates a new Items.
        Parameters:
        string - the string
      • Items

        public Items​(org.bukkit.Material material)
        Instantiates a new Items.
        Parameters:
        material - the material
      • Items

        public Items()
        Instantiates a new Items.
    • Method Detail

      • fromString

        public Items fromString​(java.lang.String string)
        Load the item from a string

        item:TYPE | gun:GUNNAME
        amount:AMOUNT
        damage:DAMAGE
        name:NAME
        lore:LORE
        enchantment:ENCHANTMENT,VALUE
        flag:FLAG
        display:DISPLAY
        attribute:ATTRIBUTE,SLOT,VALUE,OPERATION
        potion:POTION,[DURATION|EXTENDED],[STRENGTH|UPGRADED]
        leather-colour:RRR,GGG,BBB
        book-author:BOOK_AUTHOR
        book-title:BOOK_TITLE
        book-page:BOOK_PAGE
        banner:PATTERN,COLOR
        firework:FIREWORK,TRAIL,FLICKER
        firework-color:RRR,GGG,BBB
        firework-fade-color:RRR,GGG,BBB
        owner:[OWNER|UUID|URL]
        stored-enchantment:STORED_ENCHANTMENT,VALUE
        tropical-fish:COLOR,PATTERN,PATTERN_COLOR
        unbreakable
        glow

        Parameters:
        string - The Item Code
        Returns:
        Items items
      • setMaterial

        public Items setMaterial​(org.bukkit.Material material)
        Set the material
        Parameters:
        material - The Material
        Returns:
        The Item
      • getItem

        public org.bukkit.inventory.ItemStack getItem()
        Gets item.
        Returns:
        Get the item
      • getItemMeta

        public org.bukkit.inventory.meta.ItemMeta getItemMeta()
        Gets item meta.
        Returns:
        Get the item meta
      • setItemMeta

        public void setItemMeta​(org.bukkit.inventory.meta.ItemMeta itemMeta)
        Set the Item Meta
        Parameters:
        itemMeta - The ItemMeta
      • hasItemMeta

        public boolean hasItemMeta()
        Has item meta boolean.
        Returns:
        Get if ItemMeta is valid
      • addFireworkEffect

        public Items addFireworkEffect​(org.bukkit.FireworkEffect fireworkEffect)
        Add FireworkEffect
        Parameters:
        fireworkEffect - FireworkEffect
        Returns:
        Items items
      • addBannerPattern

        public Items addBannerPattern​(org.bukkit.block.banner.Pattern pattern)
        Add Banner Pattern
        Parameters:
        pattern - Pattern
        Returns:
        Items items
      • addPage

        public Items addPage​(java.lang.String value)
        Add Item to Pages
        Parameters:
        value - Page as a string
        Returns:
        Items items
      • setPages

        public Items setPages​(java.util.List<java.lang.String> value)
        Set Item Pages
        Parameters:
        value - Pages as a list
        Returns:
        Items pages
      • setPages

        public Items setPages​(java.lang.String... value)
        Set Item Pages Calls setPages(List)
        Parameters:
        value - Pages as an array
        Returns:
        Items pages
      • setBookTitle

        public Items setBookTitle​(java.lang.String value)
        Set Book Title
        Parameters:
        value - The book's title
        Returns:
        Items book title
      • setBookAuthor

        public Items setBookAuthor​(java.lang.String value)
        Set Book Author
        Parameters:
        value - The book's author
        Returns:
        Items book author
      • setUnbreakable

        public Items setUnbreakable​(boolean value)
        Set Item unbreakable Only supports versions since MC 1.12
        Parameters:
        value - Boolean
        Returns:
        Items unbreakable
      • setLeatherColor

        public Items setLeatherColor​(int red,
                                     int green,
                                     int blue)
        Set Leather Color
        Parameters:
        red - The red
        green - The green
        blue - The blue
        Returns:
        Items leather color
      • setLeatherColor

        public Items setLeatherColor​(int value)
        Set Leather Color
        Parameters:
        value - The RGB Color
        Returns:
        Items leather color
      • setAmount

        public Items setAmount​(int value)
        Set Amount
        Parameters:
        value - The amount
        Returns:
        Items amount
      • addEnchantment

        public Items addEnchantment​(org.bukkit.enchantments.Enchantment value,
                                    int level)
        Add Enchantment
        Parameters:
        value - Enchantment
        level - The level
        Returns:
        Items items
      • addPotionEffect

        public Items addPotionEffect​(org.bukkit.potion.PotionEffect value)
        Add PotionEffect
        Parameters:
        value - PotionEffect
        Returns:
        Items items
      • addGlow

        public Items addGlow()
        Add Item glow
        Returns:
        Items items
      • addLore

        public Items addLore​(java.lang.String value)
        Add Item to Lore Calls addLore(String...)
        Parameters:
        value - Lore as a String
        Returns:
        Items items
      • addLore

        public Items addLore​(java.lang.String... value)
        Add Item to Lore
        Parameters:
        value - Lore as an Array
        Returns:
        Items items
      • setLore

        public Items setLore​(java.util.List<java.lang.String> value)
        Set Item Lore
        Parameters:
        value - Lore as a list
        Returns:
        Items lore
      • setLore

        public Items setLore​(java.lang.String... value)
        Ste Item Lore Calls setLore(List)
        Parameters:
        value - Lore as an array
        Returns:
        Items lore
      • addAttribute

        public Items addAttribute​(java.lang.String attribute,
                                  java.lang.String slot,
                                  double level,
                                  java.lang.String operation)
        Add Item Attribute
        Parameters:
        attribute - Attribute's Name
        slot - Attribute's Slot
        level - Attribute's Level
        operation - Attribute's Operation
        Returns:
        Items items
      • setSplashPotion

        public Items setSplashPotion()
        Sets the item to be a splash potion
        Returns:
        Items
      • addAttribute

        public Items addAttribute​(AttributeType attribute,
                                  Slot slot,
                                  double level,
                                  Operation operation)
        Add Item Attribute using BimmCore
        Parameters:
        attribute - AttributeType
        slot - Attribute's Slot
        level - Attribute's level
        operation - Attribute's Operation
        Returns:
        Items items
      • addAttribute

        public Items addAttribute​(org.bukkit.attribute.Attribute attribute,
                                  org.bukkit.inventory.EquipmentSlot slot,
                                  double level,
                                  org.bukkit.attribute.AttributeModifier.Operation operation)
        Add Item Attribute using Bukkit
        Parameters:
        attribute - Attribute
        slot - Attribute's EquipmentSlot
        level - Attribute's level
        operation - Attribute's Operation
        Returns:
        Items items
      • setSkullOwner

        public Items setSkullOwner​(java.lang.String value)
        Set Skull Owner (Supports UUID and Names)
        Parameters:
        value - The Owner's name or UUID
        Returns:
        Items skull owner
      • setSkullOwner

        public Items setSkullOwner​(java.util.UUID value)
        Set Skull Owner Calls setSkullOwner(String)
        Parameters:
        value - Owner's UUID
        Returns:
        Items skull owner
      • setDurability

        @Deprecated
        public Items setDurability​(int value)
        Deprecated.
        Set Item Durability Use setDamage(int) instead
        Parameters:
        value - durability
        Returns:
        Items durability
      • setDamage

        public Items setDamage​(int value)
        Set Damage
        Parameters:
        value - damage
        Returns:
        Items damage
      • setDisplayName

        public Items setDisplayName​(java.lang.String value)
        Set Item Display Name
        Parameters:
        value - Name
        Returns:
        Items display name
      • addFlag

        public Items addFlag​(org.bukkit.inventory.ItemFlag flag)
        Add a Flag to an Item
        Parameters:
        flag - ItemFlag to add
        Returns:
        Items items
      • equals

        public boolean equals​(Items item,
                              boolean useLore)
        Check if 2 items are equal
        Parameters:
        item - Items to check against
        useLore - check using item's lore
        Returns:
        If the items match
      • toString

        public java.lang.String toString()
        Get the item as a string

        item:TYPE | gun:GUNNAME
        amount:AMOUNT
        damage:DAMAGE
        name:NAME
        lore:LORE
        enchantment:ENCHANTMENT,VALUE
        flag:FLAG
        display:DISPLAY
        attribute:ATTRIBUTE,SLOT,VALUE,OPERATION
        potion:POTION,[DURATION|EXTENDED],[STRENGTH|UPGRADED]
        leather-colour:RRR,GGG,BBB
        book-author:BOOK_AUTHOR
        book-title:BOOK_TITLE
        book-page:BOOK_PAGE
        banner:PATTERN,COLOR
        firework:FIREWORK,TRAIL,FLICKER
        firework-color:RRR,GGG,BBB
        firework-fade-color:RRR,GGG,BBB
        owner:[OWNER|UUID|URL]
        stored-enchantment:STORED_ENCHANTMENT,VALUE
        tropical-fish:COLOR,PATTERN,PATTERN_COLOR
        unbreakable
        glow

        Overrides:
        toString in class java.lang.Object
        Returns:
        Get the item as a string
      • getTexture

        public java.lang.String getTexture()