Fixed speed limiter

This commit is contained in:
Shoghi Cervantes 2013-09-04 20:49:14 +02:00
parent 9db1b741a7
commit 8515e7ff33
2 changed files with 4 additions and 2 deletions

View File

@ -1322,7 +1322,7 @@ class Player{
} }
} }
$speed = $this->entity->getSpeedMeasure(); $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){ if($this->lastCorrect instanceof Vector3){
$this->teleport($this->lastCorrect, $this->entity->yaw, $this->entity->pitch, false); $this->teleport($this->lastCorrect, $this->entity->yaw, $this->entity->pitch, false);
} }

View File

@ -507,13 +507,14 @@ class Entity extends Position{
} }
} }
$this->lastUpdate = $now;
if($this->class !== ENTITY_PLAYER){ if($this->class !== ENTITY_PLAYER){
$this->updateMovement(); $this->updateMovement();
if($hasUpdate === true){ if($hasUpdate === true){
$this->server->schedule(5, array($this, "update")); $this->server->schedule(5, array($this, "update"));
} }
} }
$this->lastUpdate = $now;
} }
public function updateMovement(){ public function updateMovement(){
@ -548,6 +549,7 @@ class Entity extends Position{
$this->updatePosition($this->x, $this->y, $this->z, $this->yaw, $this->pitch); $this->updatePosition($this->x, $this->y, $this->z, $this->yaw, $this->pitch);
} }
} }
$this->lastUpdate = $now;
} }
public function getDirection(){ public function getDirection(){