How can I Listen A event then cancel B event

I am working on my new plugin(FarmProtect). I need to Listen to CollideBlockEvent to know whether the Farmland is being steeped. Then I need to cancel the InteractBlockEvent to protect the farmland.
How can I cancel the InteractBlockEvent when CollideBlockEvent triggered

Use a static field (also known as global variables) to share the data that you require to check that the InteractBlockEvent is targeting your farmland (such as location or something).

After that listen to InteractBlockEvent and make sure the static field data meets the requirements, cancel the event and then reset the values from the static fields

Here is another approach that works really well:

@Listener
public void onChangeBlock(ChangeBlockEvent.Place e, @Root Player p) {
	for (Transaction<BlockSnapshot> t : e.getTransactions()) {
		if (t.getOriginal().getState().getType() == BlockTypes.FARMLAND
				&& t.getDefault().getState().getType() == BlockTypes.DIRT
				&& t.getOriginal().getPosition().add(0, 1, 0).equals(p.getPosition().toInt())) {
			t.setValid(false);
		}
	}
}