package mightypork.gamecore.control.bus.events; import mightypork.gamecore.control.bus.events.types.SingleReceiverEvent; /** * Request to execute given {@link Runnable} in main loop. * * @author MightyPork */ @SingleReceiverEvent public class MainLoopTaskRequest implements Event { private final Runnable task; public MainLoopTaskRequest(Runnable task) { this.task = task; } @Override public void handleBy(Listener handler) { handler.queueTask(task); } public interface Listener { /** * Perform the requested action * * @param request */ void queueTask(Runnable request); } }