Wierd inventory item behaviour - please help

Discussion in 'Plugin Development' started by Mineblemone, Apr 27, 2014.

Thread Status:
Not open for further replies.
  1. Hello, all I have a piece of code( you don't need to worry about the activation, that works perfectly) which creates an inventory and puts an item in it, which changes the lore according to the users balance of "coins". now, when this inventory is created, the item isn't there. It doesn't exist. But if you close the inventory, it drops. If I pick it up the lore is correct. If I insert a different item (like a sword) into another slot, it works fine. Am I doing something wrong?
    The piece of code:
    Code:
     p.closeInventory();
    Inventory buyitickets = Bukkit.createInventory(null, 9, "Buy Infernal Tickets");
    ItemStack iticket1 = new ItemStack(Material.PAPER, 1);
    ItemMeta itick1 = iticket1.getItemMeta();
             itick1.setDisplayName("§6Infernal Ticket");
              
    if(Cipmain.CoinsAmount.get(p.getName()) > 19){
             itick1.setLore(Arrays.asList("§4Standard Infernal Ticket", "§2Cost: 20 GC"));
    }
    else{
    itick1.setLore(Arrays.asList("§4Standard Infernal Ticket", "§4Cost: 20 GC"));
    }
             iticket1.setItemMeta(itick1);
             buyitickets.setItem(0, iticket1);
              p.openInventory(buyitickets);
    
     
  2. Offline

    CraftedShack

    Try using: buyitickets.addItem(iticket1);
     
  3. Hi, thanks for the reply.
    I've already tried that, it was the original code that I switched from during my troubleshooting.
     
Thread Status:
Not open for further replies.

Share This Page