Storing Entities in HashMaps problem

Discussion in 'Plugin Development' started by AwzumSauze, May 11, 2014.

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

    AwzumSauze

    When I store an Entity in a HashMap, but then unload the Chunk the Entity is in, and load it back up, the Entity is no longer part of the HashMap for some reason.. Any help on this problem?
     
  2. Offline

    rfsantos1996

    onChunkUnload {
    if(!entity.isValid()) {
    // remove from hashmap -- not removing will cause memory leaks
    }
    }

    onChunkLoad {
    chunk.getEntities() {
    // add to hashmap
    }
    }
     
  3. Offline

    AwzumSauze

    rfsantos1996
    How would I add only the specific Entity I want to the HashMap?
     
  4. Offline

    rfsantos1996

    What are you doing with HashMap?
     
  5. Offline

    PickNChew

    AwzumSauze You should use the entity's UUID instead of the object.
     
    rfsantos1996 likes this.
Thread Status:
Not open for further replies.

Share This Page