Hey all,
I need to store all the worlds that have my environment modifier running. I am using a main static class that stores all the references to each world where it is enabled(it should check this on world tick to see if the world is enabled before continuing).
My question is what is the best way to store a reference to a world? I don't want to keep a strong reference to the world object in case the world gets unloaded, or attempts to.
Ideas:
Store the dimension id and always use the DimensionManager to grab the WorldServer object
store the reference to the world in a WeakHashMap, so that the GC will collect it if needed.
use a standard reference, aka a HashMap and just hook into WorldLoad and Unload.
Opinions?