NetworkSession: do not respond to death before player spawn, fixes #3513

there's a few changes that can be made to avoid this problem, the
primary one being to separate this API from NetworkSession and abstract
it away... but this is a reasonable, although not great, solution.
This commit is contained in:
Dylan K. Taylor 2020-06-28 17:34:34 +01:00
parent 2104b2d32b
commit 0d13a3fbdb

View File

@ -645,8 +645,10 @@ class NetworkSession{
} }
public function onDeath() : void{ public function onDeath() : void{
if($this->handler instanceof InGamePacketHandler){ //TODO: this is a bad fix for pre-spawn death, this shouldn't be reachable at all at this stage :(
$this->setHandler(new DeathPacketHandler($this->player, $this)); $this->setHandler(new DeathPacketHandler($this->player, $this));
} }
}
public function onRespawn() : void{ public function onRespawn() : void{
$this->player->sendData($this->player); $this->player->sendData($this->player);