From 0d13a3fbdb6a70c622fcfcf6bde3c3b83f17d51b Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 28 Jun 2020 17:34:34 +0100 Subject: [PATCH] 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. --- src/network/mcpe/NetworkSession.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/network/mcpe/NetworkSession.php b/src/network/mcpe/NetworkSession.php index b078922a4..b1d09ea51 100644 --- a/src/network/mcpe/NetworkSession.php +++ b/src/network/mcpe/NetworkSession.php @@ -645,7 +645,9 @@ class NetworkSession{ } public function onDeath() : void{ - $this->setHandler(new DeathPacketHandler($this->player, $this)); + 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)); + } } public function onRespawn() : void{