I am trying to stop apples dropping from trees in all cases. I tried checking for a LeafDecayEvent and they removing the apple ItemStack from the list of drops, but it didn't work? Is there something special I need to do or am I missing something very obvious?
the LeavesDecayEvent don't seem to have any methods dealing with the list of drops at all don't seem to have any methods dealing with the list of drops at all....
@EventHandler public void leafDecay(LeavesDecayEvent event) { Collection<ItemStack> a = event.getBlock().getDrops(); if (a.contains(new ItemStack(Material.APPLE))) { a.remove(new ItemStack(Material.APPLE)); } }
Its a block, you cannot modify its drop list. You will need to cancel the event, and manually set the leaves to air.