isLevelLoaded() public method

public isLevelLoaded ( string $name ) : boolean
$name string
return boolean
 public function __construct(array $args, Main $main)
 {
     $this->name = $args["name"];
     $this->motto = $args["motto"];
     $this->id = $args["id"];
     $this->founder = $args["founder"];
     $this->ranks = $args["ranks"];
     $this->defaultRank = $args["default-rank"];
     $this->allyRank = $args["ally-rank"];
     $this->truceRank = $args["truce-rank"];
     $this->stdRank = $args["std-rank"];
     $this->members = $args["members"];
     $this->lastActive = $args["last-active"];
     $this->chunks = $args["chunks"];
     $this->homes = $args["homes"];
     $this->main = $main;
     $this->whitelist = $args["whitelist"];
     $this->reputation = isset($args["reputation"]) ? $args["reputation"] : 0;
     $this->server = $this->main->getServer();
     $levels = [];
     foreach ($this->chunks as $chunk) {
         $level = $chunk->getLevel();
         if (!isset($levels[$level])) {
             $levels[] = $level;
             if (!$this->server->isLevelLoaded($level)) {
                 if (!$this->server->isLevelGenerated($this->server->loadLevel($level))) {
                     $this->server->generateLevel($level, $this->main->getLevelGenerationSeed());
                 }
                 $this->server->loadLevel($level);
             }
         }
     }
     $this->initializeXEconEntity($main->getXEcon($this->server));
 }
Esempio n. 2
0
 /**
  * Get a world name and return a level object.  Loads levels as needed
  *
  * @param Server $server
  * @param str $world
  * @return Level|null
  */
 public static function getLevelByName(Server $server, $world)
 {
     if (!$server->isLevelGenerated($world)) {
         return null;
     }
     if (!$server->isLevelLoaded($world)) {
         $server->loadLevel($world);
     }
     return $server->getLevelByName($world);
 }