Andre\SurvivalGames\Main::onEnable PHP Method

onEnable() public method

public onEnable ( )
    public function onEnable()
    {
        $this->getServer()->getPluginManager()->registerEvents($this, $this);
        $this->getServer()->getScheduler()->scheduleRepeatingTask(new CallbackTask([$this, "gameTask"]), 20);
        @mkdir($this->getDataFolder(), 0777, true);
        # Custom Config Saving
        $this->saveResource("points.yml");
        $this->points = new Config($this->getDataFolder() . "points.yml", Config::YAML);
        # Custom Points Config Saving
        $this->saveResource("config.yml");
        $this->config = new Config($this->getDataFolder() . "config.yml", Config::YAML, array());
        // ------------------ MULTILANGUAGE SUPPORT ------------------ \\
        $Lang = $this->getConfig()->get('Language');
        // Just to make sure :)
        if (!file_exists('/Language/')) {
            mkdir('/Language', 0777, true);
        }
        if (!is_dir($this->getDataFolder() . "Language/Message-" . $Lang . ".yml")) {
            $this->saveResource("Language/" . $Lang . ".yml", true);
        } else {
            $this->getServer()->getLogger()->info("Loading lang file.....");
        }
        //There is a problem in this section,hope you fix them.
        $ChooseLang = new Config($this->getDataFolder() . "Language/Message-" . $Lang . ".yml", Config::YAML);
        $Already_Playing = $ChooseLang->get("Already_Playing");
        $Joined_Arena = $ChooseLang->get("Joined_Arena");
        $Not_In_Match = $ChooseLang->get("Not_In_Match");
        $Matched_Running = $ChooseLang->get("Matched_Running");
        $No_Permission = $ChooseLang->get("No_Permission");
        $Force_Start = $ChooseLang->get("Force_Start");
        $Blocked_Command = $ChooseLang->get("Blocked_Command");
        $Starting = $ChooseLang->get("Starting");
        $Timer = $ChooseLang->get("Timer");
        $Not_Enough_Players = $ChooseLang->get("Not_Enough_Players");
        $Started = $ChooseLang->get("Started");
        $Chest_Refilled = $ChooseLang->get("Chest_Refilled");
        $Deathmatch_starting = $ChooseLang->get("Deathmatch_starting");
        $Deatchmatch_started = $ChooseLang->get("Deatchmatch_started");
        $Match_Ending = $ChooseLang->get("Match_Ending");
        $Match_Ended = $ChooseLang->get("Match_Ended");
        $this->sign = $this->config->get("sign");
        $this->pos1 = $this->config->get("pos1");
        $this->pos2 = $this->config->get("pos2");
        $this->pos3 = $this->config->get("pos3");
        $this->pos4 = $this->config->get("pos4");
        $this->pos5 = $this->config->get("pos5");
        $this->pos6 = $this->config->get("pos6");
        $this->pos7 = $this->config->get("pos7");
        $this->pos8 = $this->config->get("pos8");
        $this->pos9 = $this->config->get("pos9");
        $this->pos10 = $this->config->get("pos10");
        $this->pos11 = $this->config->get("pos11");
        $this->pos12 = $this->config->get("pos12");
        $this->pos13 = $this->config->get("pos13");
        $this->pos14 = $this->config->get("pos14");
        $this->pos15 = $this->config->get("pos15");
        $this->pos16 = $this->config->get("pos16");
        $this->pos17 = $this->config->get("pos17");
        $this->pos18 = $this->config->get("pos18");
        $this->pos19 = $this->config->get("pos19");
        $this->pos20 = $this->config->get("pos20");
        $this->pos21 = $this->config->get("pos21");
        $this->pos22 = $this->config->get("pos22");
        $this->pos23 = $this->config->get("pos23");
        $this->pos24 = $this->config->get("pos24");
        $this->lastpos = $this->config->get("lastpos");
        $this->signlevel = $this->getServer()->getLevelByName($this->config->get("sign")["level"]);
        $this->sign = new Vector3($this->sign["x"], $this->sign["y"], $this->sign["z"]);
        $this->pos1 = new Vector3($this->pos1["x"] + 0.5, $this->pos1["y"], $this->pos1["z"] + 0.5);
        $this->pos2 = new Vector3($this->pos2["x"] + 0.5, $this->pos2["y"], $this->pos2["z"] + 0.5);
        $this->pos3 = new Vector3($this->pos3["x"] + 0.5, $this->pos3["y"], $this->pos3["z"] + 0.5);
        $this->pos4 = new Vector3($this->pos4["x"] + 0.5, $this->pos4["y"], $this->pos4["z"] + 0.5);
        $this->pos5 = new Vector3($this->pos5["x"] + 0.5, $this->pos5["y"], $this->pos5["z"] + 0.5);
        $this->pos6 = new Vector3($this->pos6["x"] + 0.5, $this->pos6["y"], $this->pos6["z"] + 0.5);
        $this->pos7 = new Vector3($this->pos7["x"] + 0.5, $this->pos7["y"], $this->pos7["z"] + 0.5);
        $this->pos8 = new Vector3($this->pos8["x"] + 0.5, $this->pos8["y"], $this->pos8["z"] + 0.5);
        $this->pos9 = new Vector3($this->pos9["x"] + 0.5, $this->pos9["y"], $this->pos9["z"] + 0.5);
        $this->pos10 = new Vector3($this->pos10["x"] + 0.5, $this->pos10["y"], $this->pos10["z"] + 0.5);
        $this->pos11 = new Vector3($this->pos11["x"] + 0.5, $this->pos11["y"], $this->pos11["z"] + 0.5);
        $this->pos12 = new Vector3($this->pos12["x"] + 0.5, $this->pos12["y"], $this->pos12["z"] + 0.5);
        $this->pos13 = new Vector3($this->pos13["x"] + 0.5, $this->pos13["y"], $this->pos13["z"] + 0.5);
        $this->pos14 = new Vector3($this->pos14["x"] + 0.5, $this->pos14["y"], $this->pos14["z"] + 0.5);
        $this->pos15 = new Vector3($this->pos15["x"] + 0.5, $this->pos15["y"], $this->pos15["z"] + 0.5);
        $this->pos16 = new Vector3($this->pos16["x"] + 0.5, $this->pos16["y"], $this->pos16["z"] + 0.5);
        $this->pos17 = new Vector3($this->pos17["x"] + 0.5, $this->pos17["y"], $this->pos17["z"] + 0.5);
        $this->pos18 = new Vector3($this->pos18["x"] + 0.5, $this->pos18["y"], $this->pos18["z"] + 0.5);
        $this->pos19 = new Vector3($this->pos19["x"] + 0.5, $this->pos19["y"], $this->pos19["z"] + 0.5);
        $this->pos20 = new Vector3($this->pos20["x"] + 0.5, $this->pos20["y"], $this->pos20["z"] + 0.5);
        $this->pos21 = new Vector3($this->pos21["x"] + 0.5, $this->pos21["y"], $this->pos21["z"] + 0.5);
        $this->pos22 = new Vector3($this->pos22["x"] + 0.5, $this->pos22["y"], $this->pos22["z"] + 0.5);
        $this->pos23 = new Vector3($this->pos23["x"] + 0.5, $this->pos23["y"], $this->pos23["z"] + 0.5);
        $this->pos24 = new Vector3($this->pos24["x"] + 0.5, $this->pos24["y"], $this->pos24["z"] + 0.5);
        $this->lastpos = new Vector3($this->lastpos["x"] + 0.5, $this->lastpos["y"], $this->lastpos["z"] + 0.5);
        if (!$this->config->exists("endTime")) {
            $this->config->set("endTime", 180);
        }
        if (!$this->config->exists("gameTime")) {
            $this->config->set("gameTime", 300);
        }
        if (!$this->config->exists("prefix")) {
            $this->config->set("prefix", "Game");
        }
        if (!$this->config->exists("waitTime")) {
            $this->config->set("waitTime", 180);
        }
        $this->endTime = (int) $this->config->get("endTime");
        $this->gameTime = (int) $this->config->get("gameTime");
        $this->waitTime = (int) $this->config->get("waitTime");
        $this->prefix = $this->config->get("prefix");
        $this->gameStatus = 0;
        $this->lastTime = (int) 0;
        $this->players = array();
        $this->SetStatus = array();
        $this->all = 0;
        $this->config->save();
        $version = $this->version;
        $this->getServer()->getLogger()->info("§b\n *\t\t\n *\t\t\n *  _____                  _            _  _____                           \n  / ____|                (_)          | |/ ____|                          \n | (___  _   _ _ ____   _____   ____ _| | |  __  __ _ _ __ ___   ___  ___ \n  \\___ \\| | | | '__\\ \\ / / \\ \\ / / _` | | | |_ |/ _` | '_ ` _ \\ / _ \\/ __|\n  ____) | |_| | |   \\ V /| |\\ V / (_| | | |__| | (_| | | | | | |  __/\\__ \\\n |_____/ \\__,_|_|    \\_/ |_| \\_/ \\__,_|_|\\_____|\\__,_|_| |_| |_|\\___||___/\n *\n * §cGitHub:§e GitHub.com/xZeroMCPE/SurvivalGames\n * §cUsing version: {$version}\n");
    }