How to catch event before blocks changed?


#1
@Listener(order = Order.FIRST, beforeModifications = true)
public void onChangeBlock(ChangeBlockEvent event) {
    ....
}

This code can only get the states of after block changed, I need a way to get some other blocks by the location before blocks changed.


#2

The first event to fire on BlockChange is ChangeBlockEvent.Pre

I do not understand what you need it for? Could you maybe rephrase your statement?


#3

In fact, Pre event won’t be fired when blocks change normaly. (API-7.1)

 /**
 * Called before running specific block logic at one or more 
 * {@link Location}'s such as {@link BlockTypes#FLOWING_WATER}.
 */
interface Pre extends Event, Cancellable {}

#4

How come you need it before it changes? Everything about the block before is stored in the state