function onLoad() { //Check if Lobby is not running with the match plugin if ($this->isPluginLoaded('\\ManiaLivePlugins\\MatchMakingLobby\\Match\\Plugin')) { throw new \Exception('Lobby and match cannot be one the same server.'); } $this->enableDedicatedEvents(ServerEvent::ON_PLAYER_CONNECT | ServerEvent::ON_PLAYER_DISCONNECT | ServerEvent::ON_MODE_SCRIPT_CALLBACK | ServerEvent::ON_BEGIN_MAP); $this->enableStorageEvents(StorageEvent::ON_PLAYER_CHANGE_SIDE | StorageEvent::ON_PLAYER_JOIN_GAME); /** Register to Ally Service Event */ \ManiaLive\Event\Dispatcher::register(Services\AllyEvent::getClass(), $this); $matchSettingsClass = $this->config->getMatchSettingsClassName($this->scriptName); /* @var $matchSettings \ManiaLivePlugins\MatchMakingLobby\MatchSettings\MatchSettings */ if (!class_exists($matchSettingsClass)) { throw new \Exception(sprintf("Can't find class %s. You should set up the config : ManiaLivePlugins\\MatchMakingLobby\\Config.matchSettingsClassName", $matchSettingsClass)); } $this->titleIdString = $this->connection->getSystemInfo()->titleId; $this->backLink = $this->storage->serverLogin . ':' . $this->storage->server->password . '@' . $this->titleIdString; $this->registerLobby(); $this->setLobbyInfo(); $partySize = $this->matchMaker->getNumberOfTeam() ? (int) $this->matchMaker->getPlayersPerMatch() / $this->matchMaker->getNumberOfTeam() : 1; $this->gui->createWaitingScreen(\ManiaLive\Gui\ActionHandler::getInstance()->createAction(array($this, 'onPlayerReady')), $this->scriptName, $partySize, $this->config->rulesManialink, $this->config->logoURL, $this->config->logoLink); $this->gui->configurePlayerList($partySize > 1 ? true : false); foreach (array_merge($this->storage->players, $this->storage->spectators) as $login => $obj) { //Simulate player connection $this->onPlayerConnect($login, null); } $this->updatePlayerList = true; $matchSettings = new $matchSettingsClass(); $settings = $matchSettings->getLobbyScriptSettings(); $this->connection->setModeScriptSettings($settings); $this->enableTickerEvent(); $this->connection->setCallVoteRatiosEx(false, array(new Structures\VoteRatio('SetModeScriptSettingsAndCommands', -1.0), new Structures\VoteRatio('NextMap', -1.0), new Structures\VoteRatio('JumpToMapIndex', -1.0), new Structures\VoteRatio('SetNextMapIndex', -1.0), new Structures\VoteRatio('RestartMap', -1.0))); $this->updateLobbyWindow(); //$this->gui->showHelp($this->scriptName); if ($this->config->showMasters) { $this->gui->createMasterList(); $this->updateMasterList(); } $this->connection->disableServiceAnnounces(true); $this->registerChatCommand('setAllReady', 'onSetAllReady', 0, true, \ManiaLive\Features\Admin\AdminGroup::get()); $this->registerChatCommand('kickNonReady', 'onKickNotReady', 0, true, \ManiaLive\Features\Admin\AdminGroup::get()); $this->registerChatCommand('resetPenalty', 'onResetPenalty', 1, true, \ManiaLive\Features\Admin\AdminGroup::get()); $this->registerChatCommand('resetAllPenalties', 'onResetAllPenalties', 0, true, \ManiaLive\Features\Admin\AdminGroup::get()); $this->registerChatCommand('maintenance', 'onMaintenance', 1, true, \ManiaLive\Features\Admin\AdminGroup::get()); $this->connection->restartMap(); $this->setLocalAllyAction = \ManiaLive\Gui\ActionHandler::getInstance()->createAction(array($this, 'onPlayerSetLocalAlly')); $this->unsetLocalAllyAction = \ManiaLive\Gui\ActionHandler::getInstance()->createAction(array($this, 'onPlayerUnsetLocalAlly')); }