on chunk load event?

Discussion in 'Plugin Development' started by Megolas, Aug 27, 2012.

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

    Megolas

    Hello, im trying to use the on chunk old event, yet im having a problem - it error for no reason i can see.

    Code:
    @EventHandler
    public void onChunkLoad(final ChunkLoadEvent event) {
    if (!event.isNewChunk()) return;
    for (int x = 0; x <= 15; x++) {
    for (int y = 0; y <= 127; y++) {
    for (int z = 0; z <= 15; z++) {
    Block block = event.getChunk().getBlock(x, y, z);
    if (block != null && block.getX() < 285 || block.getX() > 409 || block.getZ() < -854 || block.getZ() > -729)
    block.setTypeId(0); // error in this line
    }
    }
    }
    }
    
    can anyone see what the problem is?

    Thanks

    P.S. - its in a registered class and everything - it has other events working in it.
     
  2. Offline

    sternmin8or

    Whats the error?
     
  3. Offline

    Megolas

    I dont know - the error is recursive so it shows infinite loop of error location at XYZ - but not the error itself.
    What i do know, though, is where the error is.

    EDIT:
    Went through the log - its an overflow... how is that recursive though?
     
  4. Offline

    sternmin8or

    Could it be a out of memory error? That is a lot of recursion...
     
  5. Offline

    Giant

    sternmin8or It is actually NOT recursive. If it were, he would be calling the method again...

    Megolas Try changing 1 block only, and then checking if you do get an error.
     
  6. Offline

    Megolas

    Yep - it works with 1 block... Any ideas?
     
  7. Offline

    Giant

    In that case, try changing 50 blocks, and see the effect?
     
  8. Offline

    sternmin8or

    lol wrong word, i was looking for iteration
     
  9. Offline

    Megolas

    fixed it with Threads - uber slow though... Is there a quick way to get all of the blocks in a chunk?
     
  10. Offline

    sternmin8or

    I really dont think you are going to have ANY luck at all without using a chunkgenerator. Find a plugin that will generate a certain area of land, generate it, then use an empty chunk generator for everything else untill your server needs another reset.
     
  11. Offline

    Megolas

    I wanted to - but i want the generated area to be made using the default generator...
     
Thread Status:
Not open for further replies.

Share This Page