Want a better Minecraft server? Read about SpigotMC here!
Separate names with a comma.
Discussion in 'Spigot Plugin Development' started by aLTeR, May 26, 2015.
Hmm, I think it should work like you posted. Try this as a second option:
ItemStack item = new ItemStack (Material.INK_SACK, 1, 0, DyeColor.GREEN.getData());
You should update the players Inventory btw.
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
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.
It always has been
Well, i can't use things that won't work soon... I need to look to future...
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
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.
Also remember material data NEVER saves Enchants...this can be an issue.