mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Moved default level registration
This commit is contained in:
parent
38809f7da2
commit
7e03109576
@ -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();
|
||||
|
@ -156,6 +156,4 @@ class Flat extends Generator{
|
||||
public function getSpawn(){
|
||||
return new Vector3(128, $this->floorLevel, 128);
|
||||
}
|
||||
}
|
||||
|
||||
Generator::addGenerator(__NAMESPACE__ . "\\Flat", "flat");
|
||||
}
|
@ -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());
|
||||
|
@ -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");
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user