mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-05 01:29:55 +00:00
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:
parent
5190d9c1e2
commit
0523f26613
@ -2108,7 +2108,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
$newPos = $packet->position->subtract(0, $this->baseOffset, 0);
|
$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
|
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
|
//Still getting movements from before teleport, ignore them
|
||||||
}elseif((!$this->isAlive() or $this->spawned !== true) and $newPos->distanceSquared($this) > 0.01){
|
}elseif((!$this->isAlive() or $this->spawned !== true) and $newPos->distanceSquared($this) > 0.01){
|
||||||
$this->sendPosition($this, null, null, MovePlayerPacket::MODE_RESET);
|
$this->sendPosition($this, null, null, MovePlayerPacket::MODE_RESET);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user