DrDu Posted January 27, 2017 Share Posted January 27, 2017 How do i check if other players within my area (scArea) case ATTACK: //if(getPlayers().getAll(f->f!=null && scArea.contains()g.size()>0) { if scArea.contains(getPlayers().closest(player -> player != null && !player.equals(myPlayer())); break; Quote Link to comment Share on other sites More sharing options...
Iwin Posted January 27, 2017 Share Posted January 27, 2017 Quote Link to comment Share on other sites More sharing options...
Team Cape Posted January 27, 2017 Share Posted January 27, 2017 (edited) public boolean areaContainsPlayers(Area a) { return getPlayers().closest(p -> p != null && !p.equals(myPlayer()) && a.contains(p)) != null; } Edited January 27, 2017 by Imateamcape Quote Link to comment Share on other sites More sharing options...
DrDu Posted January 28, 2017 Author Share Posted January 28, 2017 49 minutes ago, Iwin said: thank u, is this random area 0 to 25 or? 21 minutes ago, Imateamcape said: public boolean areaContainsPlayers(Area a) { return getPlayers().closest(p -> p != null && !p.equals(myPlayer()) && a.contains(p)) != null; } didnt work for me :l Quote Link to comment Share on other sites More sharing options...
Team Cape Posted January 28, 2017 Share Posted January 28, 2017 35 minutes ago, DrDu said: thank u, is this random area 0 to 25 or? didnt work for me :l can i see the context in which you're using it? i am 100% sure the code is correct. Quote Link to comment Share on other sites More sharing options...
DrDu Posted January 28, 2017 Author Share Posted January 28, 2017 2 hours ago, Imateamcape said: can i see the context in which you're using it? i am 100% sure the code is correct. dont worry i ended up using Iwin's snippet thanks tho Quote Link to comment Share on other sites More sharing options...