How to check if an entity is a living entity

Discussion in 'Plugin Development' started by Schwarzer Zylinder, Nov 27, 2011.

Thread Status:
Not open for further replies.
  1. Hey,
    for my plugin I have to check whether an entity is an living entity.
    I used the following:
    public static void registerFrozenEntities(Location center) {
            //Get all entities
            List<Entity> entities = center.getWorld().getEntities();
            for(Entity ent : entities) {
                //If the entity is a non-living one
                if(How can I check for living entity?) {
                    //If the entity is in the circle, freeze him
                    if(ent.getLocation().distance(center) <= plugin.radius) {
                        frozenEntitiesList.put(ent, ent.getLocation());
    But how can I check if it is an
    1. LivingEntity
    2. Player
  2. Use the instanceof operator.
  3. Works, thank you!
    I should have a second look at Java basis :D
Thread Status:
Not open for further replies.

Share This Page