Use SetLocalPlayerAsInitializedPacket for spawning, fixed a bunch of bugs

this should fix forms not working during PlayerJoinEvent, and also removes the spurious PlayerItemHeldEvent firing on spawn bug.

The player MUST now send this packet. Bots take note.
This commit is contained in:
Dylan K. Taylor
2018-08-05 10:45:41 +01:00
parent 25660843c5
commit a5383b4a82
4 changed files with 23 additions and 22 deletions

View File

@ -25,6 +25,7 @@ namespace pocketmine\network\mcpe\handler;
use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\RequestChunkRadiusPacket;
use pocketmine\network\mcpe\protocol\SetLocalPlayerAsInitializedPacket;
use pocketmine\network\mcpe\protocol\StartGamePacket;
use pocketmine\network\mcpe\protocol\types\DimensionIds;
use pocketmine\Player;
@ -96,4 +97,10 @@ class PreSpawnSessionHandler extends SessionHandler{
return true;
}
public function handleSetLocalPlayerAsInitialized(SetLocalPlayerAsInitializedPacket $packet) : bool{
$this->player->doFirstSpawn();
return true;
}
}