long currentTick = world.getTime();
ArrayList<Action> actionQueue = new ArrayList<Action>();
for (Iterator<Action> it = delayedActions.iterator(); it.hasNext(); ) {
Action action = it.next();
if (action.getRunAt() <= currentTick) {
it.remove();
actionQueue.add(action);
}
}
for (Action action : actionQueue) {
try {
action.run();
} catch (Throwable t) {
t.printStackTrace();
}
}
}