For how long does chunk.load() keep a chunk loaded?

Discussion in 'Plugin Development' started by jl97, Sep 7, 2014.

Thread Status:
Not open for further replies.
  1. This is a pretty simple question, i wasn't able to find an answer though, so i ask my question here:

    Code:java
    1. World world = Bukkit.getWorld("world");
    2. Chunk c = world.getChunkAt(1, 1);
    3. c.load();


    If i were to execute this code, how long would the chunk, without a player in it or any other particular reason to keep it loaded, stay loaded? Will i have to recall chunk.load() every tick because the server automatically unloads the chunk the next tick, for loading it is, in the server's perspective, not needed? Or will the chunk stay loaded for the rest of the server's runtime, or when it will be manually unloaded with chunk.unload()?

    Thanks in advance!
     
  2. Offline

    SmooshCakez

    Unless you have a plugin to keep chunks loaded, chunks will automatically unload if a player isn't within a certain radius of it.
     
  3. So that means I'll have to make a runnable run every tick to load the specific chunks i want to keep loaded?
     
  4. Offline

    octoshrimpy

    SmooshCakez how would one go about keeping a chunk loaded?
     
  5. Offline

    SmooshCakez

    Listen for ChunkUnloadEvent, and do event.getChunk().load(); when the event is fired.
     
    octoshrimpy likes this.
  6. Offline

    mythbusterma

    SmooshCakez

    Or, don't waste CPU time and just cancel the event.
     
  7. There's a ChunkUnloadEvent!? Damn, thats gonna make life so much easier! Anyways, thank you for the help! SmooshCakez
     
  8. Offline

    mythbusterma

    jl97

    Cancel the event, don't call Chunk#load() again, it could cause unnecessary overheard.
     
Thread Status:
Not open for further replies.

Share This Page