@Override
	public void run() {
		while (!ctx.isShutdown()) {
			if (ctx.isPaused()) {
				paused = true;
				ctx.sleep(1000);
			} else {
				paused = false;

				int delay;
				try {
					delay = loop();
				} catch (Throwable throwable) {
					throwable.printStackTrace();
					delay = -1;
				}

				if (delay >= 0) {
					ctx.sleep(delay);
				} else if (delay == -1) {
					break;
				}
			}
		}
	}