Cancelling an event vs setting all it's transactions invalid

Just wondering what is the difference between cancelling an event vs setting all of it’s transactions as invalid. For instance, I have the ChangeBlockEvent.Place event listener. If I cancel the event or set all of it’s transactions as invalid I get the same result: the block isn’t placed. So is there a specific reason why, for example, you should cancel the event while keeping transactions valid? Or you should always make the transactions invalid, without canceling the event? Or even do both?

Cancelling the event is a standard within Sponge plugins, by cancelling the event, the event doesn’t get passed to any more plugins after yours (except plugin handlers which specify that it should run even if the event is cancelled). This doesnt happen in setting the transactions.

However apart from that, no real difference as far as im aware. The reason you can do both is you can specify which transaction you want to keep, if all then its easier to just cancel the event

1 Like