mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-21 10:26:38 +00:00
Properly close inventory windows from Players
This commit is contained in:
parent
441a98e60a
commit
a3e50f6337
@ -1150,7 +1150,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
$pk = new MovePlayerPacket();
|
||||
$pk->eid = 0;
|
||||
$pk->x = $from->x;
|
||||
$pk->y = $from->y + $this->getEyeHeight() + 0.01;
|
||||
$pk->y = $from->y + $this->getEyeHeight();
|
||||
$pk->z = $from->z;
|
||||
$pk->bodyYaw = $from->yaw;
|
||||
$pk->pitch = $from->pitch;
|
||||
|
@ -218,7 +218,9 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
$this->getInventory()->close($player);
|
||||
}
|
||||
}
|
||||
$this->inventory = null;
|
||||
foreach($this->inventory->getViewers() as $viewer){
|
||||
$viewer->removeWindow($this->inventory);
|
||||
}
|
||||
parent::close();
|
||||
}
|
||||
}
|
||||
|
@ -59,11 +59,11 @@ class Chest extends Spawnable implements InventoryHolder, Container{
|
||||
public function close(){
|
||||
if($this->closed === false){
|
||||
foreach($this->getInventory()->getViewers() as $player){
|
||||
$this->getInventory()->close($player);
|
||||
$player->removeWindow($this->getInventory());
|
||||
}
|
||||
|
||||
foreach($this->getRealInventory()->getViewers() as $player){
|
||||
$this->getRealInventory()->close($player);
|
||||
foreach($this->getInventory()->getViewers() as $player){
|
||||
$player->removeWindow($this->getRealInventory());
|
||||
}
|
||||
parent::close();
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ class Furnace extends Tile implements InventoryHolder, Container{
|
||||
public function close(){
|
||||
if($this->closed === false){
|
||||
foreach($this->getInventory()->getViewers() as $player){
|
||||
$this->getInventory()->close($player);
|
||||
$player->removeWindow($this->getInventory());
|
||||
}
|
||||
parent::close();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user