diff --git a/src/Player.php b/src/Player.php index 44b7fcc33..db26c7afc 100644 --- a/src/Player.php +++ b/src/Player.php @@ -632,7 +632,7 @@ class Player{ if($m !== ""){ $this->dataPacket(MC_CHAT, array( "player" => ($author instanceof Player) ? $author->username:$author, - "message" => $m, + "message" => TextFormat::clean($m), //Colors not implemented :( )); } } @@ -1284,6 +1284,7 @@ class Player{ $this->server->api->entity->spawnToAll($this->entity); $this->server->schedule(5, array($this->entity, "update"), array(), true); + $this->server->schedule(2, array($this->entity, "checkMovement"), array(), true); $this->sendArmor(); $this->sendChat($this->server->motd."\n"); diff --git a/src/world/Entity.php b/src/world/Entity.php index fdc67c956..8660bea16 100644 --- a/src/world/Entity.php +++ b/src/world/Entity.php @@ -507,6 +507,19 @@ class Entity extends Position{ } } + $this->lastUpdate = $now; + if($this->class !== ENTITY_PLAYER){ + $this->updateMovement(); + if($hasUpdate === true){ + $this->server->schedule(5, array($this, "update")); + } + } + } + + public function updateMovement(){ + if($this->closed === true){ + return false; + } if($this->isStatic === false and ($this->last[0] != $this->x or $this->last[1] != $this->y or $this->last[2] != $this->z or $this->last[3] != $this->yaw or $this->last[4] != $this->pitch)){ if($this->class === ENTITY_PLAYER or ($this->last[5] + 8) < $now){ if($this->server->api->handle("entity.move", $this) === false){ @@ -534,10 +547,6 @@ class Entity extends Position{ $this->updatePosition($this->x, $this->y, $this->z, $this->yaw, $this->pitch); } } - $this->lastUpdate = $now; - if($this->class !== ENTITY_PLAYER and $hasUpdate === true){ - $this->server->schedule(5, array($this, "update")); - } } public function getDirection(){