public class HeadlessStateChangeListener implements StateChangeSubscriber {
@Override
public void onStateChange() {
GameEngine engine = CoreRegistry.get(GameEngine.class);
GameState state = engine.getState();
if (state instanceof StateMainMenu) {
engine.shutdown();
}
}