EOD; /** * @see \ManiaControl\Plugins\Plugin::prepare() */ public static function prepare(ManiaControl $maniaControl) { } /** * @see \ManiaControl\Plugins\Plugin::getId() */ public static function getId() { return self::PLUGIN_ID; } /** * @see \ManiaControl\Plugins\Plugin::getName() */ public static function getName() { return self::PLUGIN_NAME; } /** * @see \ManiaControl\Plugins\Plugin::getVersion() */ public static function getVersion() { return self::PLUGIN_VERSION; } /** * @see \ManiaControl\Plugins\Plugin::getAuthor() */ public static function getAuthor() { return self::PLUGIN_AUTHOR; } /** * @see \ManiaControl\Plugins\Plugin::getDescription() */ public static function getDescription() { return ""; } /** * @see \ManiaControl\Plugins\Plugin::load() */ public function load(ManiaControl $maniaControl) { $this->maniaControl = $maniaControl; $this->maniaControl->getSettingManager()->initSetting($this, self::GAMEMODE_TO_LOAD, "", ""); $this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect'); $this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener("DEBUG_ReloadGamemode", $this, 'LoadGamemode'); $players = $this->maniaControl->getPlayerManager()->getPlayers(); if (!empty($players)) { $this->maniaControl->getManialinkManager()->sendManialink($this->manialink,$players); } $this->LoadGamemode(); } /** * Handle when a player connects * * @param Player $player */ public function handlePlayerConnect(Player $player) { $this->maniaControl->getManialinkManager()->sendManialink($this->manialink,$player->login); } public function LoadGamemode() { Logger::log('Load Gamemode'); $file = $this->maniaControl->getServer()->getDirectory()->getUserDataFolder() . "Scripts/Modes" . DIRECTORY_SEPARATOR . $this->maniaControl->getSettingManager()->getSettingValue($this, self::GAMEMODE_TO_LOAD); if ($file && is_file($file)) { try { $this->maniaControl->getChat()->sendSuccess("Loading In-Dev Script"); $this->maniaControl->getClient()->setModeScriptText(file_get_contents($file)); } catch (\Exception $e) { Logger::logError($e->getMessage()); $this->maniaControl->getChat()->sendErrorToAdmins($e->getMessage()); } } else { Logger::logError('No Game mode to load'); $this->maniaControl->getChat()->sendErrorToAdmins("No Game mode to load"); } } /** * Unload the plugin and its Resources */ public function unload() { } }