Solved Trying to squash a bug from multiple plugin dependencies, any suggestions?

Discussion in 'Plugin Development' started by Musaddict, Sep 6, 2013.

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

    Musaddict

    Ok, so, I'm working on a Millenaire replica plugin, where NPC's build buildings block by block.

    Here are the dependencies:
    • Loading/caching MCE schematics from WorldEdit
    • Sequentially placing blocks after an NPC walking to them via Citizens 2
    We build our buildings by starting in at 0,0,0 (relative to the schematic), and moving on the X plane, then shift over in the Z plane. Once all the X and Z blocks are finished on that layer, it moves up in the Y plane and repeats till it finishes the whole schematic.

    Here's the issue; I'm not sure if there's a bug in my code, in World Edit's code, in Citizens 2's code, in Bukkit's code, or if it's some sort of RAM failure on my computer, but I'm coming across a new bug that seems to "skip" about 2 thirds of the blocks that are supposed to be placed.

    The way we have our code set up, it's seemingly impossible to just "forget" about placing a block. It's almost as if the World Edit schematic is not fully caching for us to give placement instructions to the NPC, but I didn't know if there was a known issue with WE in regards to this.

    Lastly, to strengthen the argument that WE /may/ be bugged, it seems like we are successfully able to cache how MANY changes need to be made, but we're only able to cache 1/3 of the actual block placement changes. Therefore, once it's finished placing the 1/3 of successfully cached changes, our log is spammed with the other 2/3 of blocks being null:

    Code:
    22:04:09 [SEVERE] Exception in thread "pool-1-thread-1055"
    22:04:09 [SEVERE] org.apache.commons.lang.UnhandledException: Plugin CityScape v
    0.1.3.0 [CB 1.6.2-R0.1] generated an exception while executing task 29
            at org.bukkit.craftbukkit.v1_6_R2.scheduler.CraftAsyncTask.run(CraftAsyn
    cTask.java:56)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
            at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.NullPointerException
    Note the "pool-1-thread-1055". This is the 1055th error that's exactly like this that came from a series of errors once our building construction is complete. Also note that the error stops with "Caused by: java.lang.NullPointerException", but doesn't specify a line in the code.

    Any thoughts? I hesitate to post any source, simply because everything is so elegantly intertwined that you may need the entire project to fully grasp the code aspect. I'm just looking for generic directional tips, in case anyone knew where I should start looking from here.

    Edit: Here is an image of our NPC "upgrading" a building. In this image, he is placing the floor of the new part of the building, but as you can see it seems certain blocks were skipped.
    Image (open)
    [​IMG]
     
  2. Offline

    CubieX

    Code:
      at org.bukkit.craftbukkit.v1_6_R2.scheduler.CraftAsyncTask.run(CraftAsyn
    cTask.java:56)
    Are you using an asynchronous task for this function?

    Without seeing your implementation of your placement method, no one can say what's really going wrong.
     
  3. Offline

    Musaddict

    Got it figured out. We had some code in place as a failsafe in case the pathfinding was not able to locate the next block, and teleport the NPC after 3 seconds of inactivity.

    Reworked the whole thing, and now no errors. Still don't know how that caused such a strange "skipping" bug, as it shouldn't even have affected the placement, just the pathfinding.
     
  4. async task: dont do bukkit stuff
    sync task: do bukkit stuff

    Your case: async task: do bukkit stuff
     
Thread Status:
Not open for further replies.

Share This Page