agility plugin: Check for endpoints only when defined

When an agility course has end points defined there is no need to check
the amount of experience gained, only that it is gained at the right
location.
This commit is contained in:
Jordan Atwood
2018-07-03 13:24:10 -07:00
parent 927238fdb3
commit b9b1315637

View File

@@ -181,8 +181,9 @@ public class AgilityPlugin extends Plugin
// Get course
Courses course = Courses.getCourse(client.getLocalPlayer().getWorldLocation().getRegionID());
if (course == null
|| Math.abs(course.getLastObstacleXp() - skillGained) > 1
|| (course.getCourseEndWorldPoints().length > 0 && Arrays.stream(course.getCourseEndWorldPoints()).noneMatch(wp -> wp.equals(client.getLocalPlayer().getWorldLocation()))))
|| (course.getCourseEndWorldPoints().length == 0
? Math.abs(course.getLastObstacleXp() - skillGained) > 1
: Arrays.stream(course.getCourseEndWorldPoints()).noneMatch(wp -> wp.equals(client.getLocalPlayer().getWorldLocation()))))
{
return;
}