Allow next next location in JumpAndRun

This commit is contained in:
2025-04-26 23:56:59 +02:00
parent e72ae3cf94
commit b5a9564808
@@ -104,12 +104,18 @@ public class JumpAndRun extends BasicListener {
return; return;
} }
Vector point = points.get(index); Vector point = points.get(index);
if (location.getY() < point.getY()) { if (location.getY() < point.getY()) index = -2;
return; if (location.toVector().distanceSquared(point) >= 17) index = -2;
} if (index > 0 && index < points.size() - 1) {
if (location.toVector().distanceSquared(point) >= 17) { Vector nextPoint = points.get(index + 1);
if (location.getY() >= nextPoint.getY() && location.toVector().distanceSquared(nextPoint) < 17) {
index = index + 1;
}
}
if (index == -2) {
return; return;
} }
CURRENT_POS.put(event.getPlayer(), index); CURRENT_POS.put(event.getPlayer(), index);
event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 0.4F, 1); event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 0.4F, 1);
if (index < points.size() - 1) { if (index < points.size() - 1) {