World: Track which chunks are used by each chunk loader. #3201
Labels
Category: Core
Related to internal functionality
Type: Enhancement
Contributes features or other improvements to PocketMine-MP
Description
Track a set of chunks which each chunk loader is attached to, indexed by chunk loader.
Justification
It's currently necessary for chunk loaders to have their own systems to track which chunks they are using, for example
Player->usedChunks
.However, this is fragile and error-prone: it's possible to subscribe a
Player
as a chunk loader without it knowing.This leads to a problem with disposal of
Player
after disconnect, because they cannot unassign themselves from chunks that they don't know they are assigned to.Another manifestation is when a chunk loader is assigned to chunks in multiple worlds at the same time.
The net result of this change would be effectively equivalent to the current situation in terms of memory impact.
It would improve robustness by centralising loader chunk tracking, and allow for providing additional API features to simplify the use of chunk loaders, in addition to simplifying the implementation of chunk loaders.
The text was updated successfully, but these errors were encountered: