/** * Dispatches an event for a robot. * * <p>Too old events will not be dispatched and a critical event is always dispatched. * * @param event the event to dispatch to the robot. */ private void dispatch(Event event) { if (robot != null && event != null) { try { // skip too old events if ((event.getTime() > getTime() - MAX_EVENT_STACK) || HiddenAccess.isCriticalEvent(event)) { HiddenAccess.dispatch( event, robot, robotProxy.getStatics(), robotProxy.getGraphicsImpl()); } } catch (Exception ex) { robotProxy.println("SYSTEM: Exception occurred on " + event.getClass().getName()); ex.printStackTrace(robotProxy.getOut()); } } }