From a7a45dfe96819bba76e22b6c51579031ae35deb8 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Sun, 19 May 2013 20:53:12 +0200 Subject: [PATCH] Updated flat preset, do not allow empty Level names --- src/API/LevelAPI.php | 3 +++ src/PocketMinecraftServer.php | 2 +- src/world/generator/SuperflatGenerator.php | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/API/LevelAPI.php b/src/API/LevelAPI.php index e1967c942..00bd67ab3 100644 --- a/src/API/LevelAPI.php +++ b/src/API/LevelAPI.php @@ -108,6 +108,9 @@ class LevelAPI{ } public function levelExists($name){ + if($name === ""){ + return false; + } $path = DATA_PATH."worlds/".$name."/"; if($this->get($name) === false and !file_exists($path."level.pmf")){ $level = new LevelImport($path); diff --git a/src/PocketMinecraftServer.php b/src/PocketMinecraftServer.php index a0c0d18ac..f23bcfe47 100644 --- a/src/PocketMinecraftServer.php +++ b/src/PocketMinecraftServer.php @@ -324,8 +324,8 @@ class PocketMinecraftServer{ public function tick(){ $time = microtime(true); if($this->lastTick <= ($time - 0.05)){ - unset($this->tickMeasure[key($this->tickMeasure)]); $this->tickMeasure[] = $this->lastTick = $time; + unset($this->tickMeasure[key($this->tickMeasure)]); $this->tickerFunction($time); $this->trigger("server.tick", $time); } diff --git a/src/world/generator/SuperflatGenerator.php b/src/world/generator/SuperflatGenerator.php index cbb1082d7..9cb18cf2b 100644 --- a/src/world/generator/SuperflatGenerator.php +++ b/src/world/generator/SuperflatGenerator.php @@ -33,7 +33,7 @@ class SuperflatGenerator implements LevelGenerator{ private $level, $random, $structure, $chunks, $options, $floorLevel; public function __construct(array $options = array()){ - $this->preset = "2;7,2x3,2;1;spawn(radius=10 block=24)"; + $this->preset = "2;7,59x1,3x3,2;1;spawn(radius=10 block=89),trees"; $this->options = $options; if(isset($options["preset"])){ $this->parsePreset($options["preset"]);