DrDu Posted January 27, 2017 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;
Team Cape Posted January 27, 2017 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
DrDu Posted January 28, 2017 Author 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
Team Cape Posted January 28, 2017 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.
DrDu Posted January 28, 2017 Author 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