From 4274640845d42a1717e75cea964ed923db1be3cc Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 18 Jul 2018 15:14:18 +0100 Subject: [PATCH] Player: fixed on-ground state not being updated when walking horizontally it's possible to walk off a tower while flying without moving vertically, and this code previously wouldn't detect that, leaving a gaping hole in the anti-cheat. --- src/pocketmine/Player.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 4436ac534..b6ba9dd98 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -1487,14 +1487,11 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ } protected function checkGroundState(float $movX, float $movY, float $movZ, float $dx, float $dy, float $dz) : void{ - if(!$this->onGround or $movY != 0){ - $bb = clone $this->boundingBox; - $bb->minY = $this->y - 0.2; - $bb->maxY = $this->y + 0.2; + $bb = clone $this->boundingBox; + $bb->minY = $this->y - 0.2; + $bb->maxY = $this->y + 0.2; - $this->onGround = count($this->level->getCollisionBlocks($bb, true)) > 0; - } - $this->isCollided = $this->onGround; + $this->onGround = $this->isCollided = count($this->level->getCollisionBlocks($bb, true)) > 0; } public function canBeMovedByCurrents() : bool{