From 8515e7ff33492610cd38aa1ac07169e4a107d051 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Wed, 4 Sep 2013 20:49:14 +0200 Subject: [PATCH] Fixed speed limiter --- src/Player.php | 2 +- src/world/Entity.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Player.php b/src/Player.php index a83887c26..df50aaae2 100644 --- a/src/Player.php +++ b/src/Player.php @@ -1322,7 +1322,7 @@ class Player{ } } $speed = $this->entity->getSpeedMeasure(); - if($this->blocked === true or ($this->server->api->getProperty("allow-flight") !== true and (($speed > 7 and ($this->gamemode & 0x01) === 0x00) or $speed > 15)) or $this->server->api->handle("player.move", $this->entity) === false){ + if($this->blocked === true or ($this->server->api->getProperty("allow-flight") !== true and (($speed > 9 and ($this->gamemode & 0x01) === 0x00) or $speed > 20)) or $this->server->api->handle("player.move", $this->entity) === false){ if($this->lastCorrect instanceof Vector3){ $this->teleport($this->lastCorrect, $this->entity->yaw, $this->entity->pitch, false); } diff --git a/src/world/Entity.php b/src/world/Entity.php index f172c1a7e..de2a64580 100644 --- a/src/world/Entity.php +++ b/src/world/Entity.php @@ -507,13 +507,14 @@ class Entity extends Position{ } } - $this->lastUpdate = $now; + if($this->class !== ENTITY_PLAYER){ $this->updateMovement(); if($hasUpdate === true){ $this->server->schedule(5, array($this, "update")); } } + $this->lastUpdate = $now; } public function updateMovement(){ @@ -548,6 +549,7 @@ class Entity extends Position{ $this->updatePosition($this->x, $this->y, $this->z, $this->yaw, $this->pitch); } } + $this->lastUpdate = $now; } public function getDirection(){