I’m new to sponge plugin development and and just trying to get a feel of different events. Right now I have been focusing on cancelling events and I have ran into some trouble with cancelling leaf decay. Currently I have the leaf decay cancelled but apples and saplings etc. are still dropping even though the leaf is not decaying.
public class EventDecay {
@Listener
public void onDecay(ChangeBlockEvent.Decay e){
e.setCancelled(true);
}
}
I also tried to find the cause of the item spawning
public class EventItemDrop {
@Listener
public void onItemDrop(SpawnEntityEvent event, @First EntitySpawnCause spawnCause){
Sponge.getServer().getBroadcastChannel().send(Text.of(spawnCause));
Though that doesn’t seem to broadcast the source of the saplings/apples.