From 75f2f12b998014e6fb13ae1a98697aa188c4d002 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 10 Nov 2020 15:01:48 +0000 Subject: [PATCH] NetworkSession: rename some badly-named hooks --- src/network/mcpe/NetworkSession.php | 14 +++++++------- src/player/Player.php | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/network/mcpe/NetworkSession.php b/src/network/mcpe/NetworkSession.php index a3b40af357..81c399b3ac 100644 --- a/src/network/mcpe/NetworkSession.php +++ b/src/network/mcpe/NetworkSession.php @@ -602,17 +602,17 @@ class NetworkSession{ $this->cipher = new EncryptionContext($encryptionKey); $this->setHandler(new HandshakePacketHandler(function() : void{ - $this->onLoginSuccess(); + $this->onServerLoginSuccess(); })); $this->logger->debug("Enabled encryption"); })); }else{ - $this->onLoginSuccess(); + $this->onServerLoginSuccess(); } } } - private function onLoginSuccess() : void{ + private function onServerLoginSuccess() : void{ $this->loggedIn = true; $this->sendDataPacket(PlayStatusPacket::create(PlayStatusPacket::LOGIN_SUCCESS)); @@ -636,24 +636,24 @@ class NetworkSession{ $this->logger->debug("Sending spawn notification, waiting for spawn response"); $this->sendDataPacket(PlayStatusPacket::create(PlayStatusPacket::PLAYER_SPAWN)); $this->setHandler(new SpawnResponsePacketHandler(function() : void{ - $this->onSpawn(); + $this->onClientSpawnResponse(); })); } - private function onSpawn() : void{ + private function onClientSpawnResponse() : void{ $this->logger->debug("Received spawn response, entering in-game phase"); $this->player->setImmobile(false); //TODO: HACK: we set this during the spawn sequence to prevent the client sending junk movements $this->player->doFirstSpawn(); $this->setHandler(new InGamePacketHandler($this->player, $this)); } - public function onDeath() : void{ + public function onServerDeath() : 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)); } } - public function onRespawn() : void{ + public function onServerRespawn() : void{ $this->player->sendData(null); $this->syncAdventureSettings($this->player); diff --git a/src/player/Player.php b/src/player/Player.php index ea964dfa51..eb38968ce0 100644 --- a/src/player/Player.php +++ b/src/player/Player.php @@ -2149,7 +2149,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ $this->startDeathAnimation(); - $this->networkSession->onDeath(); + $this->networkSession->onServerDeath(); } protected function onDeathUpdate(int $tickDiff) : bool{ @@ -2187,7 +2187,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ $this->spawnToAll(); $this->scheduleUpdate(); - $this->networkSession->onRespawn(); + $this->networkSession->onServerRespawn(); } protected function applyPostDamageEffects(EntityDamageEvent $source) : void{