Removing all dropped items

Discussion in 'Plugin Development' started by LucasEmanuel, Jun 16, 2012.

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

    LucasEmanuel

    Hi, i have a little loop thats supposed to remove all dropped entitys on all loaded chunks of a world. The only problem is, that sometimes its working and sometimes its not.

    My loop:
    Code:
    // Remove all dropped items on the loaded chunks
    for (Chunk chunk : world.getLoadedChunks()) {
     
        Entity[] array = chunk.getEntities();
     
        for (int i = 0; i < array.length; i++) {
            if (array[i].getType() == EntityType.DROPPED_ITEM)
            array[i].remove();
        }
    }
    I have no idea to why its not working sometimes, but next time it is. Its working perfectly on my test server but only sometimes on my official in my sign.
     
  2. Offline

    slater96

    If this doesn't help you at all, free bump :p
    Code:
          for (Entity e : world.getEntities()) {
                if ((e instanceof Item))
                  e.remove();
     
  3. Offline

    LucasEmanuel

    Ty, will use that one instead. Dont know whether or not it will work 100% but atleast its neater then mine ;)
     
Thread Status:
Not open for further replies.

Share This Page