/**
  * @return \mysqli
  */
 public function getConn()
 {
     $mysql = $this->getFromThreadStore(self::KEY_MYSQL);
     if (!$mysql instanceof \mysqli) {
         $mysql = Credentials::getMysql();
         $this->saveToThreadStore(self::KEY_MYSQL, $mysql);
     }
     return $mysql;
 }
 public function onEnable()
 {
     $this->langs = new LanguageManager($this);
     ThetaCommand::registerAll($this, $this->getServer()->getCommandMap());
     $this->getServer()->getNetwork()->registerPacket(OldLoginPacket::NETWORK_ID, OldLoginPacket::class);
     $class = $this->getBasicListenerClass();
     $this->getServer()->getPluginManager()->registerEvents($this->listener = new $class($this), $this);
     $class = $this->getSessionListenerClass();
     $this->getServer()->getPluginManager()->registerEvents($this->sesList = new $class($this), $this);
     $this->db = Credentials::getMysql();
     new InitDbQuery($this);
     $this->getServer()->getScheduler()->scheduleDelayedRepeatingTask(new SyncStatusTask($this), 40, 20);
     $this->getServer()->getScheduler()->scheduleDelayedRepeatingTask(new SessionTickTask($this), 1, 10);
     $this->getServer()->getScheduler()->scheduleRepeatingTask($this->syncChatTask = new FireSyncChatQueryTask($this), 5);
     $this->getServer()->getScheduler()->scheduleRepeatingTask(new DbPingQuery($this), 1200);
     $this->getServer()->getScheduler()->scheduleRepeatingTask(new RestartServerTask($this), 6000);
     $this->restartTime = $this->getServer()->getTick() + 72000;
     $this->getServer()->getScheduler()->scheduleDelayedRepeatingTask(new RandomBroadcastTask($this), 2400, 2400);
     $this->getServer()->getScheduler()->scheduleDelayedTask(new CallbackPluginTask($this, function () {
         $plugin = $this->getServer()->getPluginManager()->getPlugin("FastTransfer");
         if ($plugin instanceof Plugin and $plugin->isEnabled()) {
             $this->getServer()->getPluginManager()->disablePlugin($plugin);
         }
     }), 2);
     // $RESEND_ADD_PLAYER = $this->getResendAddPlayerFreq();
     // if($RESEND_ADD_PLAYER > 0){
     //	  $this->getServer()->getScheduler()->scheduleDelayedRepeatingTask(new ResendPlayersTask($this), $RESEND_ADD_PLAYER, $RESEND_ADD_PLAYER);
     // }
     /** @noinspection PhpUsageOfSilenceOperatorInspection */
     @touch($this->getDataFolder() . "privmsg.log");
     $this->pmLog = fopen($this->getDataFolder() . "privmsg.log", "at");
     $this->faceSeeks = json_decode($this->getResourceContents("head.json"));
     $this->badWords = json_decode($this->getResourceContents("words.json"));
     $this->approvedDomains = json_decode($this->getResourceContents("approvedDomains.json"));
     $buildInfo = json_decode($this->getResourceContents("build.json"));
     $compileTime = $buildInfo->time;
     $buildNumber = $buildInfo->buildNumber;
     $buildAuthor = $buildInfo->buildAuthor;
     Utils::getURL(Credentials::IRC_WEBHOOK_STATUS . urlencode("[Status] [" . Settings::$CLASSES_NAMES[Settings::$LOCALIZE_CLASS] . "] Server at " . Settings::$LOCALIZE_IP . ":" . Settings::$LOCALIZE_PORT . " started."), 3);
     $this->getServer()->getPluginManager()->setUseTimings(true);
     TimingsHandler::reload();
     $this->getLogger()->alert("Enabled " . $this->getDescription()->getFullName() . " Build {$buildNumber} compiled at " . date("d/m/Y H:i:s (P)", $compileTime) . " (" . MUtils::time_secsToString(time() - $compileTime) . " ago) by {$buildAuthor}. MyPID is " . \getmypid() . ".");
 }