From d5012f6fcfaff16cedd46808b934ee2f840eff99 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Sat, 1 Nov 2014 03:07:47 +0100 Subject: [PATCH] Fixed server not stopping after a fatal error --- src/pocketmine/Server.php | 6 +++--- src/pocketmine/level/Level.php | 12 +++++------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 73d763fd1..cff0c0be3 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -2004,9 +2004,6 @@ class Server{ global $lastExceptionError, $lastError; $lastExceptionError = $lastError; $this->crashDump(); - $this->forceShutdown(); - kill(getmypid()); - exit(1); } public function crashDump(){ @@ -2051,6 +2048,9 @@ class Server{ //$this->checkMemory(); //$dump .= "Memory Usage Tracking: \r\n" . chunk_split(base64_encode(gzdeflate(implode(";", $this->memoryStats), 9))) . "\r\n"; + $this->forceShutdown(); + kill(getmypid()); + exit(1); } public function __debugInfo(){ diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 7e2db936b..58d1c8a73 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -1724,7 +1724,7 @@ class Level implements ChunkManager, Metadatable{ } foreach($this->chunkSendQueue[$index] as $player){ /** @var Player $player */ - if(isset($player->usedChunks[$index])){ + if($player->isConnected() and isset($player->usedChunks[$index])){ $player->sendChunk($x, $z, $payload); } } @@ -1929,15 +1929,13 @@ class Level implements ChunkManager, Metadatable{ $spawn = $this->getSpawnLocation(); } if($spawn instanceof Vector3){ - $x = Math::floorFloat($spawn->x); - $y = Math::floorFloat($spawn->y); - $z = Math::floorFloat($spawn->z); - $v = new Vector3($x, $y, $z); - for(; $v->y > 0; --$v->y){ - $b = $this->getBlock($v->getSide(0)); + $v = $spawn->floor(); + for(; $v->y > 0; $v->y -= 2){ + $b = $this->getBlock($v); if($b === null){ return $spawn; }elseif(!($b instanceof Air)){ + $v->y += 1; break; } }