Skip to content

Commit

Permalink
Fix auto respawn
Browse files Browse the repository at this point in the history
  • Loading branch information
inxomnyaa committed Dec 28, 2019
1 parent 3c8f511 commit 2e1f0b7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/specter/network/SpecterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use pocketmine\network\mcpe\protocol\LoginPacket;
use pocketmine\network\mcpe\protocol\MovePlayerPacket;
use pocketmine\network\mcpe\protocol\PacketPool;
use pocketmine\network\mcpe\protocol\PlayerActionPacket;
use pocketmine\network\mcpe\protocol\PlayStatusPacket;
use pocketmine\network\mcpe\protocol\ProtocolInfo;
use pocketmine\network\mcpe\protocol\RequestChunkRadiusPacket;
Expand Down Expand Up @@ -97,6 +98,10 @@ public function putPacket(Player $player, DataPacket $packet, bool $needACK = fa
if ($this->specter->getConfig()->get("autoRespawn")) {
$pk = new RespawnPacket();
$this->replyStore[$player->getName()][] = $pk;
$respawnPK = new PlayerActionPacket();
$respawnPK->action = PlayerActionPacket::ACTION_RESPAWN;
$respawnPK->entityRuntimeId = $player->getId();
$this->replyStore[$player->getName()][] = $respawnPK;
}
} else {
$player->spec_needRespawn = true;
Expand Down Expand Up @@ -226,6 +231,8 @@ public function decodeAdditional()
$pk->entityRuntimeId = $player->getId();

$this->sendPacket($player, $pk);

$player->setScoreTag("[SPECTER]");
} catch (\TypeError $error) {
$this->specter->getLogger()->info(TextFormat::LIGHT_PURPLE . "Specter {$player->getName()} was not spawned: LoginPacket cancelled");
return false;
Expand Down

0 comments on commit 2e1f0b7

Please sign in to comment.