Add ChunkStatusChangeEvent
Chunk Statuses are a wily thing, but it is nice to know when the state of one changes for concept like lazy-loading, etc.
I'm not sure this event should ever be anything other than read-only but this basic version has worked well for me for awhile.
The event is fired incorrectly. The chunk system changes the chunk status incrementally, and carefully handles concurrent requests to lower it. It is possible that the overall result of the operation is to lower the status, even if initially it was requested to be higher. You can see this by how the function updateCurrentState works.
You should look more carefully at the operations done in each status change to determine where to place the event. In general this area of code is the worst part of the chunk system and needs to be refactored, so it may not be possible to actually place an event in there without causing issues.
The event is fired incorrectly. The chunk system changes the chunk status incrementally, and carefully handles concurrent requests to lower it. It is possible that the overall result of the operation is to lower the status, even if initially it was requested to be higher. You can see this by how the function
updateCurrentStateworks.You should look more carefully at the operations done in each status change to determine where to place the event. In general this area of code is the worst part of the chunk system and needs to be refactored, so it may not be possible to actually place an event in there without causing issues.
I do see lower in handleFullStatusChange() that nextState is captured for subsequent potential status changes. Might be sufficient to just lower the event to after that that nextState.isOrAfter(currState) check? nextState isn't even used in that method otherwise...
Hello, does any change are needed for this before being merged ? If yes, i can take time to do it.