Solved Error I can't find <.<

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

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

    Eistee²

    Hello,
    I my first error is this

    Code:
    13:15:38 [SEVERE] Exception in thread "pool-1-thread-3"
    13:15:38 [SEVERE] org.apache.commons.lang.UnhandledException: Plugin Animals v1.
    0 generated an exception while executing task 2
            at org.bukkit.craftbukkit.scheduler.CraftAsyncTask.run(CraftAsyncTask.ja
    va: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.util.NoSuchElementException
            at org.bukkit.craftbukkit.util.UnsafeList$Itr.next(UnsafeList.java:247)
            at org.bukkit.craftbukkit.entity.CraftEntity.getNearbyEntities(CraftEnti
    ty.java:185)
            at de.eistee2.animals.AnimalCheck$1.run(AnimalCheck.java:40)
            at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:53)
            at org.bukkit.craftbukkit.scheduler.CraftAsyncTask.run(CraftAsyncTask.ja
    va:53)
            ... 3 more
    
    After this error (when the scheduler run again) i get this:
    Code:
    13:19:03 [SEVERE] Encountered an unexpected exception NullPointerException
    java.lang.NullPointerException
            at net.minecraft.server.World.getCubes(World.java:964)
            at net.minecraft.server.Entity.move(Entity.java:462)
            at net.minecraft.server.EntityItem.h_(EntityItem.java:61)
            at net.minecraft.server.World.entityJoinedWorld(World.java:1245)
            at net.minecraft.server.WorldServer.entityJoinedWorld(WorldServer.java:5
    11)
            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:547)
            at net.minecraft.server.DedicatedServer.q(DedicatedServer.java:213)
            at net.minecraft.server.MinecraftServer.p(MinecraftServer.java:474)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:406)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:539)
    The only code is;

    Code:
        public void enable(Plugin plugin)
        {
            taskID = Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(plugin, new Runnable()
            {
                public void run()
                    {
                        for(Player p : Bukkit.getOnlinePlayers())
                        {
                            List<Entity> allEntitys = p.getNearbyEntities(10, 10, 10);
                            System.out.println(allEntitys);
                            if(allEntitys.size() == 0)
                            {
                                System.out.println("Nichts gefunden");
                            }
                            else
                            {
                                for(Entity e : allEntitys)
                                {
                                    if(e instanceof Animals)
                                    {
                                        List<Entity> allAround = e.getNearbyEntities(50, 10, 50);
                                        if(allAround.size() != 0)
                                        {
                                            for(Entity f : allAround)
                                            {
                                                if(f.getClass() == e.getClass())
                                                {
                                                    Animals hey = (Animals) f;
                                                    System.out.println(hey);
                                                }
                                            }
                                        }
                                    }
                                }
                                System.out.println("Geht");
                            }
                        }
                    }
            },100,100);
        }
    it is wondering me that it dosen´t throw the error directly ,only after a random amount of time :/
     
  2. Offline

    Vandrake

    If there is noone online... you know he won't find any entities nearby... xD right?
     
  3. Offline

    Lolmewn

    It shouldn't run if there is no-one online, I think.
     
    KollegahDerBoss and Vandrake like this.
  4. Offline

    Eistee²

    When no one is only nothing happen ;)
    Only when i join and wait a bit the error appears after some repeats :(
     
  5. dont use the async task, you creating the bugs byy lakking o fthread safety
     
    Eistee² likes this.
  6. Offline

    Woobie

    Not to be rude, but do you write with your toes?
     
    KollegahDerBoss likes this.
  7. Offline

    Eistee²

    Thanks work now :)
     
  8. I sometimes have times that I type faster than I want and making much of spelling mistakes, but the main part is, he understand it.
     
Thread Status:
Not open for further replies.

Share This Page