Solved Saving blocks/entities in Lists?

Discussion in 'Plugin Development' started by Chinwe, Sep 5, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Chinwe

    Just a quick question:

    I know you shouldn't store Player objects in Collections due to them being kept in memory and preventing chunks/worlds from being unloaded - is it the same with Blocks and Entities? Should I stick with Locations and UUIDs for keeping track of them? :oops:
     
  2. Offline

    evilmidget38

    Chinwe Keeping Block references can cause chunks to remain loaded as a Block stores a reference to the chunk. Entities maintain a reference to the world similarly to players, and are frequently removed when a chunk unloads, sometimes permanently(depending upon whether or not they're persistent). Because of this, it's very easy to end up holding on to stale entity references..

    Holding onto the UUID is probably your best bet for entities. For blocks you can use locations, but those keep a reference to the World, so keep that in mind.
     
    lukegb and Chinwe like this.
  3. Offline

    Chinwe

Thread Status:
Not open for further replies.

Share This Page