[SOLVED] How to load chunks

Discussion in 'Spigot Plugin Development' started by elraro, Jul 3, 2015.

  1. Hi! Im maiking a minigame and i need make a Fireworks generator in a location. But i have a problem. I cant get locations while these chunk isnt loaded... So... How can i load chunks before create my generator? And what happen if these chunk is unloaded? How can i reload it again?
     
  2. Creeoer

    Supporter

    chunk.Load(); if you want to keep the chunks loaded add them to a list and listen to the ChunkUnloadEvent,if it were to be in the list then cancel the event.
     
    • Agree Agree x 1
  3. if (!(new Location(Bukkit.getWorld(this.getWorld()), 3985, 71, 68)).getChunk().isLoaded())
    {
    (new Location(Bukkit.getWorld(this.getWorld()), 3985, 71, 68)).getChunk().load();
    }

    Null pointer.

    Why? :/
     
  4. Maybe your issue is because of something else, can you post more code?
     
  5. Change "this.getWorld()" to your worlds name, since getWorld() probably isn't returning anything.
     
  6. Remember guys, if u get a location, first load the world.

    LOL.

    Solved.
     
    • Funny Funny x 4
    • Like Like x 1