From ffcdf499124b4220931d36dbbb74940994107148 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Tue, 17 Mar 2015 17:38:10 +0100 Subject: [PATCH] Allow plugins to cancel some kicks better, closes #2743 --- src/pocketmine/Player.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 56d54c702..a604dee7f 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -1249,16 +1249,16 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ $this->entityBaseTick(1); - if($this->speed and $this->isSurvival()){ + if($this->speed and $this->forceMovement === null and $this->isSurvival()){ $speed = sqrt($this->speed->x ** 2 + $this->speed->z ** 2); if($speed > 0.45){ $this->highSpeedTicks += $speed > 3 ? 2 : 1; if($this->highSpeedTicks > 40 and !$this->server->getAllowFlight()){ - $this->kick("Flying is not enabled on this server"); - return false; + if($this->kick("Flying is not enabled on this server")){ + return false; + } }elseif($this->highSpeedTicks >= 10 and $this->highSpeedTicks % 4 === 0){ $this->forceMovement = $this->getPosition(); - $this->speed = null; } }elseif($this->highSpeedTicks > 0){ if($speed < 22){ @@ -1279,8 +1279,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ if($diff > 0.6 and $expectedVelocity < $this->speed->y and !$this->server->getAllowFlight()){ if($this->inAirTicks < 100){ $this->setMotion(new Vector3(0, $expectedVelocity, 0)); - }else{ - $this->kick("Flying is not enabled on this server"); + }elseif($this->kick("Flying is not enabled on this server")) return false; } }