本文整理汇总了PHP中pocketmine\plugin\Plugin::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugin::getConfig方法的具体用法?PHP Plugin::getConfig怎么用?PHP Plugin::getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\plugin\Plugin
的用法示例。
在下文中一共展示了Plugin::getConfig方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(Plugin $plugin)
{
$this->plugin = $plugin;
$config = $this->plugin->getConfig()->get("dataProviderSettings");
if (!isset($config["host"]) or !isset($config["user"]) or !isset($config["password"]) or !isset($config["database"])) {
$this->plugin->getLogger()->critical("Invalid MySQL settings");
$this->plugin->setDataProvider(new DummyDataProvider($this->plugin));
return;
}
$this->database = new \mysqli($config["host"], $config["user"], $config["password"], $config["database"], isset($config["port"]) ? $config["port"] : 3306);
if ($this->database->connect_error) {
$this->plugin->getLogger()->critical("Couldn't connect to MySQL: " . $this->database->connect_error);
$this->plugin->setDataProvider(new DummyDataProvider($this->plugin));
return;
}
$resource = $this->plugin->getResource("mysql.sql");
$this->database->query(stream_get_contents($resource));
fclose($resource);
$this->plugin->getServer()->getScheduler()->scheduleRepeatingTask(new MySQLPingTask($this->plugin, $this->database), 600);
// Each 30 seconds
$this->plugin->getLogger()->info("Connected to MySQL server");
}