Help

Discussion in 'Spigot Plugin Development' started by byTrentox., May 27, 2017.

  1. How can i clear all the Entitys? And yes. It not works if i delete the if condition with the villager ;). It will makes me glitch in the air. I think its because of, that Players are also entitys xd. So does anyone have an idea?

    for(Entity e : p.getWorld().getEntities()) {
    if (e instanceof Zombie){
    e.remove();
    }
    }
    }
     
  2. Mas

    Mas

    Could you be a bit clearer on what you are trying to do?
    What you are currently doing should remove all entities from a player's world.
    If you don't want to remove players, just check if the entity is a player first (entity instanceof Player)
     
    • Agree Agree x 1
  3. Code (Text):
    for(Entity e : p.getWorld().getEntities()) {
        if(!(e instanceof Player)) {
            e.remove();
        }
    }
    Same logic as your original code, but it won't remove any entity that is a player.
     
    • Agree Agree x 1
  4. I was so freakin dumb xd. Thanks ^^.