What is the difference between Break,Modify,Post in ChangeBlockEvent?

I’ve been working on a regions-protection plugin recently, and there are always various mod items that can break event intercepts, such as: block break are canceled, but the block still drops item.I think this is because I didn’t understand the nature of the event. I can’t understand the explanation of MODIFY and POST in the API document. Does the POST include break and place?Would anyone like to explain to me the difference?

Modify
So the event for modify is when a block changes its state in the world. What i mean by that is something like a switch changing from off state to on, or a food based plant such as carrots changing how far they have grown.

Break
Break is where a block (of any kind) is broken. Your able to get all net affects of the broken block such as a door, whereby the top half of it was broken but your also able to get the bottom half. This means that the block is now in a state of Schrödinger’s cat, whereby the blocks could be broken in the world or not, only by checking the actual value do you know … However you never need to do so, but it comes into Post.

Post
Post is the complete opposite to pre whereby the changes (and the net changes) have occured for all stages of ChangeBlockEvent (except if one of the stages was cancelled). Thereby you can use Location to go across the world and the block that will appear is the changed states, thereby the door we broke part of in break would be gone (both halves). If the user turned redstone on (activating the Modify) then we would be able to find all the redstone in the ON state (as well as what powers it), etc.

Just remember that this may help you. Take a look at the descriptions for each class.

https://jd.spongepowered.org/7.2.0/org/spongepowered/api/event/block/ChangeBlockEvent.html

Thank you very much. After your explanation, I think I understand modify,
But I still don’t know enough about POST. Can I just use break and place and ignore it?

Yes, very few developers that im aware actually use it. And even then most of them used it to check if there modify/break event was cancelled or not.

But to be honest, unless your needing to do something like getting all connected blocks of a structure of a type and your wanting to keep that structure up to date, then I don’t see much of a use for it as the … present (for lack of a better name) events will typically do the job.

Thank you very very much for your patience.

I didnt use any of my patience, its been a plesure.

1 Like