Created
May 17, 2013 00:38
-
-
Save zhuowei/5596202 to your computer and use it in GitHub Desktop.
Multiworld loader for PocketMine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
__PocketMine Plugin__ | |
name=MultiWorld | |
description=Quick and dirty multiworld loader for PocketMine | |
version=1.0 | |
author=zhuowei | |
class=MultiWorldPlugin | |
apiversion=7 | |
*/ | |
/* | |
Small Changelog | |
=============== | |
1.0: Initial release | |
*/ | |
class MultiWorldPlugin implements Plugin{ | |
private $api; | |
public function __construct(ServerAPI $api, $server = false){ | |
$this->api = $api; | |
} | |
public function init(){ | |
$this->loadAllWorlds(); | |
} | |
public function loadAllWorlds() { | |
$path = DATA_PATH."worlds/"; | |
$files = scandir($path); | |
foreach($files as $f) { | |
if ($f !== "." && $f !== ".." && is_dir($path.$f)) { | |
$this->api->level->generateLevel($f); | |
$this->api->level->loadLevel($f); | |
} | |
} | |
} | |
public function __destruct(){ | |
} | |
} |
Also, a fix has been released to PocketMine-MP so already loaded worlds return true on LevelAPI::loadLevel()
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fixed: