Set immobile flag on player pre-spawn

The client likes to fall involuntarily as soon as PLAYER_SPAWN PlayStatus is sent, which causes debug spam on the PM side and then movement reversions if falling far enough. This now prevents the client moving until the server knows the client has spawned.
This commit is contained in:
Dylan K. Taylor 2018-10-12 17:08:22 +01:00
parent acb794e728
commit c96203b528

View File

@ -76,6 +76,8 @@ class PreSpawnSessionHandler extends SessionHandler{
$pk->worldName = $this->server->getMotd();
$this->session->sendDataPacket($pk);
$this->player->setImmobile(); //HACK: fix client-side falling pre-spawn
$this->player->getLevel()->sendTime($this->player);
$this->player->sendAttributes(true);
@ -99,6 +101,8 @@ class PreSpawnSessionHandler extends SessionHandler{
}
public function handleSetLocalPlayerAsInitialized(SetLocalPlayerAsInitializedPacket $packet) : bool{
$this->player->setImmobile(false); //HACK: this is set to prevent client-side falling before spawn
$this->player->doFirstSpawn();
return true;