Chunk loads just after unloading

Discussion in 'Plugin Development' started by marwzoor, Aug 17, 2014.

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

    marwzoor

    Hey guys!

    I am developing a plugin with NPCs and I want the NPCs to despawn when the chunk they are in is unloaded. This works fine and when I fly away from the NPC it despawns just as planned. The only thing is that it respawns again 1 second later.

    I am listening to ChunkUnloadEvent and ChunkLoadEvent. Does anyone know why the ChunkLoadEvent for the same chunk is being called just after the chunk has been unloaded? Maybe the NPC is causing it to load again?

    Would be really greatful for any help.

    Request for aid. fireblast709

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  2. Offline

    fireblast709

    marwzoor there can be multiple causes. Perhaps a plugin is causing it to load?
     
  3. Offline

    marwzoor

    The only plugin on the server is mine. I know that I don't load the chunk in any way.

    The weird thing is, if the NPC would cause the chunk to stay loaded, then the ChunkLoad and ChunkUnload events wouldn't be called for that chunk, right?
     
  4. Offline

    fireblast709

    marwzoor note that chunks aren't only loaded when you explicitly call the load method. Getting Blocks from the World, for example, also loads the chunk.
     
  5. Offline

    marwzoor

    Yeah but I'm pretty certain that no methods that could trigger the load are used. If not world.removeEntity triggers it of course.
     
Thread Status:
Not open for further replies.

Share This Page