-

Discussion in 'Spigot Plugin Development' started by aLTeR, May 26, 2015.

  1. -
     
    #1 aLTeR, May 26, 2015
    Last edited: Apr 22, 2016
  2. Hmm, I think it should work like you posted. Try this as a second option:

    Code (Text):
    ItemStack item = new ItemStack (Material.INK_SACK, 1, 0, DyeColor.GREEN.getData());
    You should update the players Inventory btw.

    Code (Text):
    event.getPlayer().updateInventory();
     
  3. I dont need to update player's inventory... Server(methods) does that automatically. And one more thing, this constructor is deprecated, that means it won't be used at all soon. It was left as warning to update. I just reported issue with itemstacks: https://hub.spigotmc.org/jira/browse/SPIGOT-928
     
  4. Yeah, i know its deprecated. But for now it still is possible to do it that way. Sometimes there are bugs with fake items still staying in the Inventory of the player when not updating it.
     
  5. It always has been
     
    • Agree Agree x 1
  6. Well, i can't use things that won't work soon... I need to look to future...
     
  7. The ItemStack constructors are deprecated for a long time now. They never got removed. Im not even sure if they will ever be removed. Soon is in 3 years maybe. But well, I would better take a deprecated constructor than a not working one ;) But thats up to you
     
  8. There are other ways, you could simply convert MaterialData to ItemStack, and it's not deprecated. I was searching for way to apply data for itemstack that is already created.
     
    #8 aLTeR, May 26, 2015
    Last edited: May 26, 2015
  9. Also remember material data NEVER saves Enchants...this can be an issue.