lrdblk Posted February 22, 2017 Share Posted February 22, 2017 I made this snippet for my wood cutter. You can use the code to check how many people are surrounding any entity. First import import static java.lang.Math.toIntExact; Here is the snippet. e = the entity you are checking areaSize = the size of the area around the entity you want to check. private int peopleAroundEntity (Entity e, int areaSize){ return toIntExact(players.getAll().stream().filter(x -> e.getArea(areaSize).contains(x)).count()); } And this is how I used the snippet private Predicate<RS2Object> bestTree = tree -> tree != null && chopArea.contains(tree) && tree.getName().equalsIgnoreCase(treeType) && tree.hasAction("Chop down") && peopleAroundEntity(tree, 2) <= 3; java.util.List<RS2Object> tree = getObjects().getAll().stream().filter(bestTree).collect(Collectors.toList()); Then from there you can sort the list as you want. For this script, I have it sorted by distance tree.sort(Comparator.<RS2Object>comparingInt(a -> getMap().realDistance(a)) .thenComparingInt(b -> getMap().realDistance(b))); The whole script can be found on my github https://github.com/MeatRainbow/Wood_Chopper Hope this helps someone 2 Quote Link to comment Share on other sites More sharing options...