Force loading chunks

Discussion in 'Plugin Development' started by cfil360, Nov 1, 2014.

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

    cfil360

    I am trying to force load a chunk, but it isn't working correctly.
    Code:java
    1. Chunk c = Game.getInstance().getWorld().getChunkAt(startX, startZ);
    2. do {
    3. c.load(); //load chunk if it isn't loaded
    4. }while(!c.isLoaded());
     
  2. We need more information to help you. If you just say that it's not working correctly, we can't know what's wrong and thus can't help you.
     
  3. Offline

    cfil360

    Assist well there are no errors and when i teleport the player to the location the chunk still has to load.
     
  4. Offline

    RawCode

    for what reason you try to load chunk?

    what result you expect from your actions?
     
  5. Offline

    Watto

    RawCode

    He probably expects a loaded chunk...
     
    cfil360 likes this.
  6. Offline

    cfil360

    RawCode i am trying to preload a map before teleporting players.
     
  7. Offline

    RawCode

    Watto

    Loading chunk do NOTHING, it instantly unload if no player in range.
     
  8. Offline

    Watto

    RawCode
    Why do all your posts seem angry :c

    cfil360
    I'm not sure if this is causing any issues but i think the while loop could be doing something dodgy.
    Have you tried just running the chunk.load method and then having an ChunkLoadEvent to detect and TP?

    I've never played with Chunks so i'm not very useful tbh :p
     
  9. Offline

    cfil360

    RawCode so how can i get the chunk to stay loaded?
     
  10. Offline

    Watto

    cfil360
    ChunkUnloadEvent
    Check if chunk is correct chunk
    setCancelled?
     
  11. Offline

    RawCode

    cfil360
    I still do not understand what you want.

    There is completely no reason to preload anything, bukkit handle teleportations properly by itself.
     
  12. Offline

    cfil360

    RawCode its for a UHC plugin. Players want the world to be preloaded before the game begins.
     
  13. Offline

    RawCode

    And what difference you want to archive?

    What go wrong\not as you like currently? cfil360
     
  14. Offline

    cfil360

    RawCode like i teleport the players after i load the chunks, however the chunks still have to load even after canceling them with the chunk unload event.
     
  15. Offline

    RawCode

    cfil360
    I will enable libastral now...

    You want your players to see area instantly, right?
    This wont happen.
     
  16. Offline

    cfil360

    RawCode can you explain why this can't happen?
     
Thread Status:
Not open for further replies.

Share This Page