public function savePlayer(IPlayer $player, array $config)
 {
     $name = trim(strtolower($player->getName()));
     $data = new Config($this->plugin->getDataFolder() . "players/" . $name[0] . "/{$name}.yml", Config::YAML);
     $data->setAll($config);
     $data->save();
 }
 public function __construct(DAMATAuth $plugin)
 {
     $this->plugin = $plugin;
     if (!file_exists($this->plugin->getDataFolder() . "players.db")) {
         $this->database = new \SQLite3($this->plugin->getDataFolder() . "players.db", SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE);
         $resource = $this->plugin->getResource("sqlite3.sql");
         $this->database->exec(stream_get_contents($resource));
         fclose($resource);
     } else {
         $this->database = new \SQLite3($this->plugin->getDataFolder() . "players.db", SQLITE3_OPEN_READWRITE);
     }
 }
 public function __construct(DAMATAuth $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("올바르지 않은 MySQL 설정");
         $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("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("MySQL 서버에 연결했습니다");
 }