Ejemplo n.º 1
0
 public static function createSampleLevel(HungerGamesPlugIn $plugin)
 {
     $portal = new GameLevel("sample_portal");
     $portal->levelName = "portal";
     $portal->displayName = "map portal";
     $portal->type = self::TYPE_LEVEL_ONE;
     $portal->enterpos = new Position("128", "12", "123");
     $portal->enterLevelName = "HG_Island";
     $portal->exitpos = new Position("128", "12", "123");
     $portal->exitLevelName = "MinigamesHub";
     $portal->location = new Position("128", "12", "123");
     $portal->maps = array("catching_fire", "hg_tornament");
     $portal->save($plugin->getDataFolder());
 }
Ejemplo n.º 2
0
 public static final function preloadArenas(HungerGamesPlugIn &$plugin)
 {
     $arenaList = [];
     $path = $plugin->getDataFolder() . self::ARENA_DIRECTORY;
     if (!file_exists($path)) {
         @mkdir($path, 0755, true);
     }
     $plugin->log("#loading arenas on " . $path);
     $handler = opendir($path);
     while (($filename = readdir($handler)) !== false) {
         $plugin->getLogger()->info($filename);
         if ($filename != "." && $filename != "..") {
             $data = new Config($path . $filename, Config::YAML);
             Server::getInstance()->loadLevel($data->get("levelName"));
             $arenaLevel = Server::getInstance()->getLevelByName($data->get("levelName"));
             $name = str_replace(".yml", "", $filename);
             $arena = self::loadArenaByName($plugin->getDataFolder(), $name);
             $arenaList[$name] = $arena;
         }
     }
     closedir($handler);
     return $arenaList;
 }