Ensure thread safe?

Discussion in 'Plugin Development' started by FurmigaHumana, Sep 9, 2012.

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

    FurmigaHumana

    Problem solved, I was using 'scheduleAsync' when was supposed to be using 'scheduledSync'!

    Show Spoiler

    I made a simple code to spawn a random entity in a predefined location, it spawns 1 mob per second until hit the defined limit and cancels the task.

    Ok, so, it works, but only if I don't have any other plugin in the server, here is the code in question
    http://pastebin.com/ky2Ec15m

    Here is the error:
    Creature Spawn Error: http://pastebin.com/raw.php?i=2e6RBebf
    Chunk Load Error: http://pastebin.com/raw.php?i=nrGYfkxF

    Line 151: if (loc.getChunk().isLoaded()) {
    Line 152: loc.getWorld().spawnEntity(loc, type);

    Any ideias? I don't understand why this is generating exceptions...

    Obs: if you have any tip to improve this code, please tell me xD

    Thanks
     
Thread Status:
Not open for further replies.

Share This Page