/** * 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); }
public function getLevel(Server $server) { return $server->getLevelByName($this->levelName); }