From 97f6b80969da973c137057bca01003cf40bda733 Mon Sep 17 00:00:00 2001 From: dktapps Date: Mon, 22 Aug 2016 19:45:25 +0100 Subject: [PATCH] Fix players levitating in beds and teleportation of sleeping players --- src/pocketmine/Player.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index ca253c2e0b..edb9d7e4a8 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -980,7 +980,6 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade } $this->sleeping = clone $pos; - $this->teleport(new Position($pos->x + 0.5, $pos->y - 0.5, $pos->z + 0.5, $this->level)); $this->setDataProperty(self::DATA_PLAYER_BED_POSITION, self::DATA_TYPE_POS, [$pos->x, $pos->y, $pos->z]); $this->setDataFlag(self::DATA_PLAYER_FLAGS, self::DATA_PLAYER_FLAG_SLEEP, true); @@ -1491,8 +1490,9 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade $this->timings->startTiming(); if($this->spawned){ - $this->processMovement($tickDiff); - + if(!$this->isSleeping()){ + $this->processMovement($tickDiff); + } $this->entityBaseTick($tickDiff); if(!$this->isSpectator() and $this->speed !== null){ @@ -3361,6 +3361,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade $this->resetFallDistance(); $this->nextChunkOrderRun = 0; $this->newPosition = null; + $this->stopSleep(); return true; } return false;