Fixed inventory being sent before spawning

This commit is contained in:
Shoghi Cervantes 2014-07-14 16:27:04 +02:00
parent ebe8a902e5
commit 6e77901453
3 changed files with 6 additions and 6 deletions

View File

@ -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"));

View File

@ -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;
}

View File

@ -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;
}