Want a better Minecraft server? Read about SpigotMC here!
Separate names with a comma.
Discussion in 'Spigot Plugin Development' started by Digital, Jul 8, 2015.
Why check the inventory if you just want to remove the skull use this:
ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1 ,(short) 3);
SkullMeta meta = (SkullMeta) skull.getItemMeta();
Check if the inventory contains a skull item and get the owner of that skull.
if (plr.getInventory().contains(Material.SKULL_ITEM, 1, (short) 3)
//Whatever you'r trying to do
Don't copy paste that, that is just kind of an idea of where to go, I don't know what your working with exactly here, event wise or other. You do need to get the owner of the skull though, You may have to play with that a little but once you figure out where to getOwner from, it should all come together. That code above is surely way off, just kind of off the top of my head and I just woke up, but the getOwner part is what you need there. You shouldn't need the item stack if you're looking for a skull that is already in the inventory, just need that owner part. Than you can remove it or whatever you are trying to do with it. The more I look at that the more I think about how horrid it looks, hopefully you get the idea though. If not, I will try to better that solution once I have some coffee.