Solved Removing nearby entities within radius

Discussion in 'Plugin Development' started by ThunderWaffeMC, Mar 7, 2014.

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

    ThunderWaffeMC

    Hi. I'm using the below to remove all dropped signs in the radius of 5 around a player:

    Code:java
    1.  
    2. public void removeItems(String pName) {
    3. String playerName = pName;
    4. Player player = Bukkit.getPlayer(playerName);
    5. List<Entity> nearby = player.getNearbyEntities(10, 10, 10);
    6. for (Entity entity : nearby) {
    7. if(entity instanceof Item) {
    8. Item item = (Item) entity;
    9. if(item.getType() == Material.SIGN) {
    10. entity.remove();
    11. }
    12. }
    13. }
    14. }
    15.  


    I'm getting an eclipse from error saying 'Incompatible operand types EntityType and Material' even though I've cast Item to the item variable.

    Any help is appreciated, thank you!
     
  2. Offline

    xTrollxDudex

Thread Status:
Not open for further replies.

Share This Page