Please help with error!

Discussion in 'Plugin Development' started by Muod, Oct 23, 2013.

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

    Muod

    I urgently need help with a small error that i don't know how to fix!

    CODE:

    List nearby = player.getNearbyEntities(32.0D, 32.0D, 32.0D);
    player.getHandle().playerConnection.sendPacket(sPacket);

    for (Entity entity2 : nearby)
    if ((entity2 instanceof Player))
    {
    if (entity2.getLocation().distance(location) <= 32.0D)
    ((CraftPlayer)entity2).getHandle().playerConnection.sendPacket(sPacket);
    }
    }


    ERROR:
    Type mismatch: cannot convert from element type Object to Entity
    ^^^^^^^^^^
    that happens with the word nearby where it says for (Entity entity2 : nearby)
    PLEASE HELP!!!
     
  2. Offline

    5pHiNxX

    @Muod:
    use
    Code:java
    1. List<Entity> nearby = player.getNearbyEntities(32.0D, 32.0D, 32.0D);

    instead of
    Code:java
    1. List nearby = player.getNearbyEntities(32.0D, 32.0D, 32.0D);
     
Thread Status:
Not open for further replies.

Share This Page