Code:java ItemStack cobble = new ItemStack(Material.COBBLESTONE, 400);p.getInventory().remove(cobble);p.updateInventory(); Why this didnt remove any cobblestone?
DevManABCD I'm fairly sure that you're trying to remove an item stack of 400 cobblestone which won't work unless they have a stack of 400 cobblestone.
If you want to clear their inventory of cobblestone, you could use Code:java for(int i = 0; i < 36; i++){ if(p.getInventory().getItem(i) != null && p.getInventory().getItem(i).getType() == Material.COBBLESTONE){ p.getInventory().setItem(i, null); }} I'm not sure if there is a better way, I just woke up and this was the first idea that came to my head. What it does it it creates a loop that repeats 36 times. 36 is the size of the inventory of a player. It then checks the player's item in that slot to see if it's cobblestone. If it is, it'll set it to nothing. Hope this has helped.
stormneo7 Code:java for(int i = 0; i < p.getInventory().getSize(); i++){ if(p.getInventory().getItem(i) != null && p.getInventory().getItem(i).getType() == Material.COBBLESTONE){ p.getInventory().setItem(i, null); }} Neater to use Inventory.getSize()
DevManABCD Iterate through all items in the player's inventory. When you find cobblestone, remove it. Keep track of how much you have removed until you reach 400.