Moved default level registration

This commit is contained in:
Shoghi Cervantes 2014-03-28 13:07:36 +01:00
parent 38809f7da2
commit 7e03109576
4 changed files with 9 additions and 9 deletions

View File

@ -36,6 +36,7 @@ use PocketMine\Event\HandlerList;
use PocketMine\Event\Server\PacketReceiveEvent;
use PocketMine\Event\Server\PacketSendEvent;
use PocketMine\Item\Item;
use PocketMine\Level\Generator\Generator;
use PocketMine\Level\Level;
use PocketMine\Network\Packet;
use PocketMine\Network\Query\QueryHandler;
@ -552,6 +553,10 @@ class Server{
Block::init();
Item::init();
Crafting::init();
Generator::addGenerator("PocketMine\\Level\\Generator\\Flat", "flat");
Generator::addGenerator("PocketMine\\Level\\Generator\\Normal", "normal");
Generator::addGenerator("PocketMine\\Level\\Generator\\Normal", "default");
Level::init();
$this->properties->save();

View File

@ -156,6 +156,4 @@ class Flat extends Generator{
public function getSpawn(){
return new Vector3(128, $this->floorLevel, 128);
}
}
Generator::addGenerator(__NAMESPACE__ . "\\Flat", "flat");
}

View File

@ -31,7 +31,7 @@ abstract class Generator{
private static $list = array();
public static function addGenerator($object, $name){
if(is_subclass_of($object, "\PocketMine\Level\Generator\Generator") and !isset(Generator::$list[$name])){
if(is_subclass_of($object, "\\PocketMine\\Level\\Generator\\Generator") and !isset(Generator::$list[$name])){
Generator::$list[$name] = $object;
return true;
@ -45,7 +45,7 @@ abstract class Generator{
return Generator::$list[$name];
}
return "\PocketMine\Level\Generator\Normal";
return "\\PocketMine\\Level\\Generator\\Normal";
}
public abstract function __construct(array $settings = array());

View File

@ -186,7 +186,4 @@ class Normal extends Generator{
return $this->level->getSafeSpawn(new Vector3(127.5, 128, 127.5));
}
}
Generator::addGenerator(__NAMESPACE__ . "\\Normal", "normal");
Generator::addGenerator(__NAMESPACE__ . "\\Normal", "default");
}