diff --git a/.gitignore b/.gitignore index 9cca0e13e..0408f9670 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,9 @@ test_data/* # Doxygen Documentation/* + +# PHPUnit +/.phpunit.result.cache + +# php-cs-fixer +/.php_cs.cache diff --git a/build/php b/build/php index d475b694e..0aa88d276 160000 --- a/build/php +++ b/build/php @@ -1 +1 @@ -Subproject commit d475b694e4889e403fe430b88be9f535b7d4af02 +Subproject commit 0aa88d27659c7fa91cb467547fde12dca926529b diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 42f5c97a0..49b4d8825 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -1379,9 +1379,16 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ if($this->isSpectator()){ $this->setFlying(true); $this->keepMovement = true; + $this->onGround = false; + + //TODO: HACK! this syncs the onground flag with the client so that flying works properly + //this is a yucky hack but we don't have any other options :( + $this->sendPosition($this, null, null, MovePlayerPacket::MODE_TELEPORT); + $this->despawnFromAll(); }else{ $this->keepMovement = $this->allowMovementCheats; + $this->checkGroundState(0, 0, 0, 0, 0, 0); if($this->isSurvival()){ $this->setFlying(false); } @@ -1502,11 +1509,15 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ } protected function checkGroundState(float $movX, float $movY, float $movZ, float $dx, float $dy, float $dz) : void{ - $bb = clone $this->boundingBox; - $bb->minY = $this->y - 0.2; - $bb->maxY = $this->y + 0.2; + if($this->isSpectator()){ + $this->onGround = false; + }else{ + $bb = clone $this->boundingBox; + $bb->minY = $this->y - 0.2; + $bb->maxY = $this->y + 0.2; - $this->onGround = $this->isCollided = count($this->level->getCollisionBlocks($bb, true)) > 0; + $this->onGround = $this->isCollided = count($this->level->getCollisionBlocks($bb, true)) > 0; + } } public function canBeMovedByCurrents() : bool{ diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 554b929fa..813d80aad 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -2092,17 +2092,24 @@ class Server{ if($report){ $url = ((bool) $this->getProperty("auto-report.use-https", true) ? "https" : "http") . "://" . $this->getProperty("auto-report.host", "crash.pmmp.io") . "/submit/api"; + $postUrlError = "Unknown error"; $reply = Internet::postURL($url, [ "report" => "yes", "name" => $this->getName() . " " . $this->getPocketMineVersion(), "email" => "crash@pocketmine.net", "reportPaste" => base64_encode($dump->getEncodedData()) - ]); + ], 10, [], $postUrlError); - if($reply !== false and ($data = json_decode($reply)) !== null and isset($data->crashId) and isset($data->crashUrl)){ - $reportId = $data->crashId; - $reportUrl = $data->crashUrl; - $this->logger->emergency($this->getLanguage()->translateString("pocketmine.crash.archive", [$reportUrl, $reportId])); + if($reply !== false and ($data = json_decode($reply)) !== null){ + if(isset($data->crashId) and isset($data->crashUrl)){ + $reportId = $data->crashId; + $reportUrl = $data->crashUrl; + $this->logger->emergency($this->getLanguage()->translateString("pocketmine.crash.archive", [$reportUrl, $reportId])); + }elseif(isset($data->error)){ + $this->logger->emergency("Automatic crash report submission failed: $data->error"); + } + }else{ + $this->logger->emergency("Failed to communicate with crash archive: $postUrlError"); } } } diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 12657d50f..97ac40b4b 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -1868,7 +1868,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ $this->setMotion($this->temporalVector->setComponents(0, 0, 0)); if($this->setPositionAndRotation($pos, $yaw ?? $this->yaw, $pitch ?? $this->pitch)){ $this->resetFallDistance(); - $this->onGround = true; + $this->setForceMovementUpdate(); $this->updateMovement(true);