Added protection for fast movements

This commit is contained in:
Shoghi Cervantes Pueyo
2013-03-24 11:02:37 +01:00
parent 14ab386b0f
commit 88a1f83545
2 changed files with 20 additions and 8 deletions

View File

@@ -753,8 +753,9 @@ class Player{
break;
}
if(($this->entity instanceof Entity) and $data["counter"] > $this->lastMovement){
$this->lastMovement = $data["counter"];
if($this->server->api->handle("player.move", $this->entity) === false){
$this->lastMovement = $data["counter"];
$speed = $this->entity->getSpeed();
if(($speed > 5 and $this->gamemode !== CREATIVE) or $speed > 12 or $this->server->api->handle("player.move", $this->entity) === false){
$this->teleport(new Vector3($this->entity->x, $this->entity->y, $this->entity->z), $this->entity->yaw, $this->entity->pitch);
}else{
$this->entity->setPosition($data["x"], $data["y"], $data["z"], $data["yaw"], $data["pitch"]);