maniaControl->getChat()->sendErrorToAdmins('MatchManager Core is needed to use MatchManager Multiple Config Manager plugin. Install it and restart Maniacontrol'); Logger::logError('MatchManager Core is needed to use MatchManager Multiple Config Manager plugin. Install it and restart Maniacontrol'); return false; } use MatchManagerSuite\MatchManagerCore; /** * MatchManager Widgets * * @author Beu * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 */ class MatchManagerMultipleConfigManager implements ManialinkPageAnswerListener, CommandListener, CallbackListener, Plugin { /* * Constants */ const PLUGIN_ID = 171; const PLUGIN_VERSION = 1.0; const PLUGIN_NAME = 'MatchManager Multiple Config Manager'; const PLUGIN_AUTHOR = 'Beu'; // MatchManagerWidget Properties const MATCHMANAGERCORE_PLUGIN = 'MatchManagerSuite\MatchManagerCore'; const DB_MATCHCONFIG = 'MatchManager_MatchConfigs'; /* * Private properties */ /** @var ManiaControl $maniaControl */ private $maniaControl = null; private $MatchManagerCore = null; /** * @param \ManiaControl\ManiaControl $maniaControl * @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 'Manage your multiple MatchManager configurations'; } /** * @param \ManiaControl\ManiaControl $maniaControl * @return bool * @see \ManiaControl\Plugins\Plugin::load() */ public function load(ManiaControl $maniaControl) { // Init plugin $this->maniaControl = $maniaControl; $this->MatchManagerCore = $this->maniaControl->getPluginManager()->getPlugin(self::MATCHMANAGERCORE_PLUGIN); if ($this->MatchManagerCore == Null) { throw new \Exception('MatchManager Core is needed to use MatchManager Players Pause plugin'); } $this->initTables(); return true; } /** * @see \ManiaControl\Plugins\Plugin::unload() */ public function unload() { } /** * Initialize needed database tables */ private function initTables() { $mysqli = $this->maniaControl->getDatabase()->getMysqli(); $query = 'CREATE TABLE IF NOT EXISTS `' . self::DB_MATCHCONFIG . '` ( `id` int NOT NULL AUTO_INCREMENT, `name` VARCHAR(255) NOT NULL, `gamemodebase` VARCHAR(32) NOT NULL, `config` TEXT, `date` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;'; $mysqli->query($query); if ($mysqli->error) { trigger_error($mysqli->error, E_USER_ERROR); } } }