So I've got this player and I'm getting their location, then in the future I'm getting their new location and calculating a vector between them. Problem is, the expression that calculates the players new location is evaluated before the runnable is executed.
Entity entity = ...
Coordinates oldLocation = entity.getLocation();
delayedTasks.add(new TimedAction(2, TimeUnit.SECONDS () -> {
Coordinates newLocation = entity.getLocation();
Direction direction = Direction.getVector(oldLocation, newLocation);
//this is returning no direction because old location and new location are the same
}));