1. For security reasons it is recommended that all users upgrade to Minecraft 1.8.3 by re-running BuildTools. A fix for 1.8 is also available via the --rev 1.8 argument. At this stage there is no fix for 1.7.10 or below, however given these builds have been unsupported for more than 7 months, we recommend that all servers look into upgrading. For those using Vanilla, it is anticipated a fixed 1.8.4 version will be released by Mojang soon.

Asynchronous entity add!

Discussion in 'BungeeCord Plugin Development' started by Craftiii4, Jul 14, 2013.

  1. I'm getting the following error (only on spigot builds);

    Code (text):
    2013-07-14 09:39:41 [SEVERE] Exception in thread "Craft Scheduler Thread - 0"
    2013-07-14 09:39:41 [SEVERE] org.apache.commons.lang.UnhandledException: Plugin [Plugin-name] v1.0.0 generated an exception while executing task 5
        at org.bukkit.craftbukkit.v1_6_R2.scheduler.CraftAsyncTask.run(CraftAsyncTask.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.IllegalStateException: Asynchronous entity world add!
        at net.minecraft.server.v1_6_R2.World.a(World.java:2481)
        at net.minecraft.server.v1_6_R2.Chunk.addEntities(Chunk.java:683)
        at net.minecraft.server.v1_6_R2.ChunkProviderServer.getChunkAt(ChunkProviderServer.java:128)
        at net.minecraft.server.v1_6_R2.ChunkProviderServer.getChunkAt(ChunkProviderServer.java:84)
        at org.bukkit.craftbukkit.v1_6_R2.CraftWorld.getChunkAt(CraftWorld.java:119)
        at org.bukkit.craftbukkit.v1_6_R2.CraftWorld.getBlockAt(CraftWorld.java:83)
        at org.bukkit.craftbukkit.v1_6_R2.CraftWorld.getBlockAt(CraftWorld.java:485)
        at org.bukkit.Location.getBlock(Location.java:82)
        at me.craftiii4.[Plugin-name].Nation.StartCapture.ChangeFlag(StartCapture.java:42)
        at me.craftiii4.[Plugin-name].Player.AddAndRemove$2.run(AddAndRemove.java:178)
        at org.bukkit.craftbukkit.v1_6_R2.scheduler.CraftTask.run(CraftTask.java:58)
        at org.bukkit.craftbukkit.v1_6_R2.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
        ... 3 more
    On this line here;

    Code (text):
    while (locationoffirstwool.getBlock().getType() != Material.WOOL && locationoffirstwool.getY() <= 255) {
    The code around it is;

    Code (text):

    public static void ChangeFlag(String nation, final Location locationofsponge) {
    Location locationoffirstwool = locationofsponge;
        while (locationoffirstwool.getBlock().getType() != Material.WOOL && locationoffirstwool.getY() <= 255) {
            locationoffirstwool.add(0, 1, 0);
    This is called from a AsynTask, which is what is causing the error, but I fail to see why this is causing the error it is causing?

    Any help would be appreciated thanks.
  2. Switch the order of the statements in the while loop. Y gets incremented to 256 and then the block is checked before it is checked to be <= 255.
  3. Run the actual setting of the wool in a sync method. Spigot is saving your server. Editing the world like such in an asynchronous thread will corrupt the world.
  4. #4
    • Like Like x 1
  5. Thanks, I will try these once I get back.