Send forced movement when getting bad movements after teleport, fixes AlwaysSpawn-type plugins

it's mostly harmless to send it here anyway
This commit is contained in:
Dylan K. Taylor 2017-09-23 12:49:46 +01:00
parent 5190d9c1e2
commit 0523f26613

View File

@ -2108,7 +2108,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$newPos = $packet->position->subtract(0, $this->baseOffset, 0);
if($this->isTeleporting and $newPos->distanceSquared($this) > 1){ //Tolerate up to 1 block to avoid problems with client-sided physics when spawning in blocks
$this->server->getLogger()->debug("Ignoring outdated pre-teleport movement from " . $this->getName() . ", received " . $newPos . ", expected " . $this->asVector3());
$this->sendPosition($this, null, null, MovePlayerPacket::MODE_RESET);
$this->server->getLogger()->debug("Got outdated pre-teleport movement from " . $this->getName() . ", received " . $newPos . ", expected " . $this->asVector3());
//Still getting movements from before teleport, ignore them
}elseif((!$this->isAlive() or $this->spawned !== true) and $newPos->distanceSquared($this) > 0.01){
$this->sendPosition($this, null, null, MovePlayerPacket::MODE_RESET);