-
Posts
4523 -
Joined
-
Last visited
-
Days Won
10 -
Feedback
100%
Community Answers
-
Eliot's post in Closest object for an area/point in Osbot2? was marked as the answer
script.objects.closest(new BestMatch(script, name, area));
public class BestMatch implements Filter<RS2Object> {
Script script;
String name;
Area area;
public BestMatch(Script script, String name, Area area) {
this.script = script;
this.name = name;
this.area = area;
}
@Override
public boolean match(RS2Object o) {
return o.getName().equals(name)
&& area.contains(o) && script.map.canReach(o);
}
}