public function __construct(Main $tntRun) { $this->tntRun = $tntRun; $settings = $this->tntRun->getConfig()->get("mysql-settings"); $this->db = new \mysqli($settings["host"], $settings["username"], $settings["password"], $settings["database"], isset($settings["port"]) ? $settings["port"] : 3306); if ($this->db->connect_error) { $tntRun->getLogger()->critical("Couldn't connect to MySQL: " . $this->db->connect_error); $tntRun->getServer()->shutdown(); return; } $this->db->query("CREATE TABLE IF NOT EXISTS tntstats (name VARCHAR(16) PRIMARY KEY, matches INT, wins INT)"); $tntRun->getServer()->getScheduler()->scheduleRepeatingTask(new TaskPingMySQL($tntRun), 600); }
public function __construct(Main $tntRun) { if ($tntRun->getServer()->getPluginManager()->getPlugin("PocketMoney") instanceof Plugin) { $version = explode(".", $tntRun->getServer()->getPluginManager()->getPlugin("PocketMoney")->getDescription()->getVersion()); if ($version[0] < 4) { $tntRun->getLogger()->critical("The version of PocketMoney is too old! Please update PocketMoney to version 4.0.1"); $tntRun->getServer()->shutdown(); } $this->PocketMoney = $tntRun->getServer()->getPluginManager()->getPlugin("PocketMoney"); } elseif ($tntRun->getServer()->getPluginManager()->getPlugin("EconomyAPI") instanceof Plugin) { $version = explode(".", $tntRun->getServer()->getPluginManager()->getPlugin("EconomyAPI")->getDescription()->getVersion()); if ($version[0] < 2) { $tntRun->getLogger()->critical("The version of EconomyAPI is too old! Please update EconomyAPI to version 2.0.8"); $tntRun->getServer()->shutdown(); } $this->EconomyS = $tntRun->getServer()->getPluginManager()->getPlugin("EconomyAPI"); } elseif ($tntRun->getServer()->getPluginManager()->getPlugin("MassiveEconomy") instanceof Plugin) { $this->MassiveEconomy = $tntRun->getServer()->getPluginManager()->getPlugin("MassiveEconomy"); } else { $tntRun->getLogger()->critical("This plugin to work needs the plugin PocketMoney or EconomyS or MassiveEconomy."); $tntRun->getServer()->shutdown(); } }