function close($onPurpose = true)
 {
     if ($this->server) {
         if ($onPurpose) {
             $this->server->notifyUnregister();
             foreach ($this->privilegeKeys as $key) {
                 $this->server->privilegeKeyDelete($key);
             }
         }
         $this->server->clientListReset();
         $this->server->channelListReset();
         $this->server = null;
         $this->playersGroupId = 0;
         $this->privilegeKeys = array();
     }
     if ($this->processHandler && $this->processId) {
         $this->processHandler->killThread($this->processId);
         $this->processId = null;
     }
     Dispatcher::unregister(AppEvent::getClass(), $this);
     Dispatcher::unregister(TickEvent::getClass(), $this);
     // TODO something to avoid memory leaks when unloading the plugin
     // but the TS framework is f*cked up (plenty of circular references
     // which can't be unset from outside...)
 }
示例#2
0
 protected function __construct()
 {
     $this->modalBg = new Bgs1(340, 200);
     $this->modalBg->setSubStyle(Bgs1::BgDialogBlur);
     $this->modalBg->setAlign('center', 'center');
     $this->modalBg->setPosZ(Window::Z_MODAL);
     $this->modalBg->setScriptEvents();
     $this->nextLoop = microtime(true);
     Dispatcher::register(AppEvent::getClass(), $this, AppEvent::ALL & ~AppEvent::ON_POST_LOOP);
     Dispatcher::register(PlayerEvent::getClass(), $this, PlayerEvent::ON_PLAYER_CHANGE_SIDE);
     Dispatcher::register(ServerEvent::getClass(), $this, ServerEvent::ON_PLAYER_CONNECT | ServerEvent::ON_PLAYER_DISCONNECT);
     $config = \ManiaLive\DedicatedApi\Config::getInstance();
     $this->connection = Connection::factory($config->host, $config->port, $config->timeout, $config->user, $config->password);
 }
示例#3
0
 protected function __construct()
 {
     Dispatcher::register(AppEvent::getClass(), $this, AppEvent::ON_INIT | AppEvent::ON_POST_LOOP);
     Dispatcher::register(ServerEvent::getClass(), $this, ServerEvent::ALL);
 }
示例#4
0
 function stop()
 {
     $this->running = false;
     Dispatcher::unregister(AppEvent::getClass(), $this);
     Dispatcher::unregister(TickEvent::getClass(), $this);
 }
示例#5
0
 protected function __construct()
 {
     Dispatcher::register(AppEvent::getClass(), $this, AppEvent::ON_INIT | AppEvent::ON_TERMINATE);
     Dispatcher::register(ServerEvent::getClass(), $this, ServerEvent::ON_SERVER_START | ServerEvent::ON_SERVER_STOP);
 }
示例#6
0
 function __construct()
 {
     $this->time = time();
     Dispatcher::register(AppEvent::getClass(), $this, AppEvent::ON_PRE_LOOP);
 }
示例#7
0
 /**
  * Stop listening for application events.
  */
 protected final function disableApplicationEvents($events = AppEvent::ALL)
 {
     $this->restrictIfUnloaded();
     Dispatcher::unregister(AppEvent::getClass(), $this, $events & $this->eventsApplication);
     $this->eventsApplication &= ~$events;
 }