new BukkitRunnable() { int frameIndex = 0; @Override public void run() { if (this.frameIndex >= animation.getFrames().size()) cancel(); Frame frame = animation.getFrames().get(this.frameIndex++); MathUtils.corDir(player, new Location(startLocation.getWorld(), frame.getLocation().getX(), frame.getLocation().getY(), frame.getLocation().getZ(), frame.getRot().getX(), frame.getRot().getZ()), 2, 2); if (frameIndex <= 1) startCallback.run(); frame.getMarkers().forEach(markerCallback::accept); } @Override public synchronized void cancel() throws IllegalStateException { if (endCallback != null) endCallback.run(); super.cancel(); } }.runTaskTimer(AlixAPI.getInstance(), 0, 1); }