final function run()
 {
     try {
         $this->init();
         Dispatcher::dispatch(new Event(Event::ON_RUN));
         self::$startTime = microtime(true);
         $nextCycleStart = self::$startTime;
         $cycleTime = 1 / static::CYCLES_PER_SECOND;
     } catch (\Exception $e) {
         ErrorHandling::processRuntimeException($e);
     }
     try {
         while ($this->running) {
             Dispatcher::dispatch(new Event(Event::ON_PRE_LOOP));
             $calls = $this->connection->executeCallbacks();
             if (!empty($calls)) {
                 foreach ($calls as $call) {
                     $method = preg_replace('/^[[:alpha:]]+\\./', '', $call[0]);
                     // remove trailing "Whatever."
                     $params = (array) $call[1];
                     Dispatcher::dispatch(new \ManiaLive\DedicatedApi\Callback\Event($method, $params));
                 }
             }
             $this->connection->executeMulticall();
             Dispatcher::dispatch(new Event(Event::ON_POST_LOOP));
             $endCycleTime = microtime(true) + $cycleTime / 10;
             do {
                 $nextCycleStart += $cycleTime;
             } while ($nextCycleStart < $endCycleTime);
             @time_sleep_until($nextCycleStart);
         }
     } catch (\Exception $e) {
         ErrorHandling::processRuntimeException($e);
     }
     Dispatcher::dispatch(new Event(Event::ON_TERMINATE));
 }