Solved Illegal State Exception

Discussion in 'Plugin Development' started by zachoooo, Oct 24, 2012.

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

    zachoooo

    Code:
    @EventHandler
        public void onTNTExplode(EntityExplodeEvent event) {
            for (Iterator<Block> it = event.blockList().iterator(); it.hasNext();) {
                it.remove();
            }
            return;
        }
    I tried using this code to prevent other errors like conccurentmodification exception, but now Im getting this
    Code:
    org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:341)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:477)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:462)
    at net.minecraft.server.Explosion.a(Explosion.java:203)
    at net.minecraft.server.World.createExplosion(World.java:1524)
    at net.minecraft.server.WorldServer.createExplosion(WorldServer.java:745)
    at net.minecraft.server.EntityTNTPrimed.explode(EntityTNTPrimed.java:81)
    at net.minecraft.server.EntityTNTPrimed.h_(EntityTNTPrimed.java:61)
    at net.minecraft.server.World.entityJoinedWorld(World.java:1245)
    at net.minecraft.server.WorldServer.entityJoinedWorld(WorldServer.java:511)
    at net.minecraft.server.World.playerJoinedWorld(World.java:1227)
    at net.minecraft.server.World.tickEntities(World.java:1125)
    at net.minecraft.server.WorldServer.tickEntities(WorldServer.java:428)
    at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:563)
    at net.minecraft.server.DedicatedServer.q(DedicatedServer.java:213)
    at net.minecraft.server.MinecraftServer.p(MinecraftServer.java:473)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:405)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:539)
    Caused by: java.lang.IllegalStateException
    at java.util.ArrayList$Itr.remove(ArrayList.java:767)
    at com.survivorspvp.ttt.TTTListener.onTNTExplode(TTTListener.java:220)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:339)
    ... 18 more
    Any ideas?

    EDIT: I am trying to block tnt from doing block damage.

    EDIT2: The problem is on it.remove();

    EDIT3: Solved with it.next();
     
Thread Status:
Not open for further replies.

Share This Page