From 6e7790145385356aa9a9412929f2754589a7044f Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Mon, 14 Jul 2014 16:27:04 +0200 Subject: [PATCH] Fixed inventory being sent before spawning --- src/pocketmine/Player.php | 8 ++++---- src/pocketmine/inventory/BaseInventory.php | 2 +- src/pocketmine/inventory/PlayerInventory.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index dc4019854..78d531653 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -625,10 +625,6 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ $this->spawned = true; - $this->sendSettings(); - $this->inventory->sendContents($this); - $this->inventory->sendArmorContents($this); - $this->blocked = false; $pk = new SetTimePacket; @@ -643,6 +639,10 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ $this->teleport($ev->getRespawnPosition()); + $this->sendSettings(); + $this->inventory->sendContents($this); + $this->inventory->sendArmorContents($this); + $this->spawnToAll(); $this->server->getPluginManager()->callEvent($ev = new PlayerJoinEvent($this, TextFormat::YELLOW . $this->getName() . " joined the game")); diff --git a/src/pocketmine/inventory/BaseInventory.php b/src/pocketmine/inventory/BaseInventory.php index abb67c8aa..33e5b5f96 100644 --- a/src/pocketmine/inventory/BaseInventory.php +++ b/src/pocketmine/inventory/BaseInventory.php @@ -392,7 +392,7 @@ abstract class BaseInventory implements Inventory{ } foreach($target as $player){ - if(($id = $player->getWindowId($this)) === -1){ + if(($id = $player->getWindowId($this)) === -1 or $player->spawned !== true){ $this->close($player); continue; } diff --git a/src/pocketmine/inventory/PlayerInventory.php b/src/pocketmine/inventory/PlayerInventory.php index 1c5dc7ac4..a388a510e 100644 --- a/src/pocketmine/inventory/PlayerInventory.php +++ b/src/pocketmine/inventory/PlayerInventory.php @@ -333,7 +333,7 @@ class PlayerInventory extends BaseInventory{ $pk->hotbar[] = $index <= -1 ? -1 : $index + 9; } } - if(($id = $player->getWindowId($this)) === -1){ + if(($id = $player->getWindowId($this)) === -1 or $player->spawned !== true){ $this->close($player); continue; }