Cancel past movements

This commit is contained in:
Shoghi Cervantes Pueyo 2013-03-20 14:56:18 +01:00
parent 4ff9753ede
commit 9bd4b02908

View file

@ -33,6 +33,7 @@ class Player{
private $lastBuffer = 0; private $lastBuffer = 0;
private $recovery = array(); private $recovery = array();
private $evid = array(); private $evid = array();
public $lastMovement = 0;
public $timeout; public $timeout;
public $connected = true; public $connected = true;
public $clientID; public $clientID;
@ -741,7 +742,8 @@ class Player{
if($this->loggedIn === false){ if($this->loggedIn === false){
break; break;
} }
if($this->entity instanceof Entity){ if(($this->entity instanceof Entity) and $data["counter"] > $this->lastMovement){
$this->lastMovement = $data["counter"];
$this->entity->setPosition($data["x"], $data["y"], $data["z"], $data["yaw"], $data["pitch"]); $this->entity->setPosition($data["x"], $data["y"], $data["z"], $data["yaw"], $data["pitch"]);
$this->server->api->dhandle("player.move", $this->entity); $this->server->api->dhandle("player.move", $this->entity);
} }