pocketmine\inventory\TemporaryInventory::onClose PHP Метод

onClose() публичный Метод

public onClose ( Player $who )
$who pocketmine\Player
    public function onClose(Player $who)
    {
        foreach ($this->getContents() as $slot => $item) {
            if ($slot === $this->getResultSlotIndex()) {
                //Do not drop the item in the result slot - it is a virtual item and does not actually exist.
                continue;
            }
            $who->dropItem($item);
        }
        $this->clearAll();
    }

Usage Example

Пример #1
0
 public function onClose(Player $who)
 {
     parent::onClose($who);
     $this->getHolder()->getLevel()->dropItem($this->getHolder()->add(0.5, 0.5, 0.5), $this->getItem(0));
     $this->getHolder()->getLevel()->dropItem($this->getHolder()->add(0.5, 0.5, 0.5), $this->getItem(1));
     $this->clear(0);
     $this->clear(1);
     $this->clear(2);
 }
All Usage Examples Of pocketmine\inventory\TemporaryInventory::onClose