Solved Setting an itemstacks datavalue

Discussion in 'Spigot Plugin Development' started by EvanTheSurfer, May 30, 2016.

  1. So i have a public itemstack, and i made a new itemstack method that returns the auctionitem (but with enchant ect) . So i need to get auctionItems datavalue and include it in this itemstack below.

    MyCode:
    Code (Text):
    ItemStack item = new ItemStack(this.auctionItem.getType(), this.itemAmmount, (short) auctionItems data goes here..);
     
  2. auctionItems.getDurability()? Or do you want to copy the ItemMeta as well?
     
  3. Figured it out. Wasnt thinking :p

    Code (Text):
        public ItemStack Item() {
           
            ItemStack item = new ItemStack(this.auctionItem.getType(), this.itemAmmount);
           

                item.setItemMeta(auctionItem.getItemMeta());
                item.addEnchantments(auctionItem.getEnchantments());
                item.setDurability(auctionItem.getDurability());
                item.setData(auctionItem.getData());
               
       
       
            return item;
        }
     
    • Like Like x 1