.getPlayer() for monsters and animals?

Discussion in 'Plugin Development' started by Ineentho, Apr 22, 2011.

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

    Ineentho

    Hello,

    I am new to bukkit development and haven't found a good way of selecting an animal by the id (you know the F3-names used for "wallhacking".
    I know that I can use
    Code:
    World.getLivingEntities();
    however, I haven't been able to find a good way to search it by entity id.

    Any suggestions on how to?
     
  2. Offline

    matter123

    try this
    Code:
    List<LivingEntity> list=World.getLivingEntities();
    int id=XXXXXX;
    entity entity;
    for (LivingEntity i : list) {
        if (i.getentityif()==id) {
            entity=i;
            break;
        }
    }
     
  3. Offline

    Ineentho

    Thanks, works great! :)
     
  4. Offline

    matter123

    no problem
    and how would i match a partial player name to a player object
     
  5. Offline

    nisovin

    Server.matchPlayer(String)
     
Thread Status:
Not open for further replies.

Share This Page