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(); }
public function execute(Player $source) : bool { $droppedItem = $this->getTargetItem(); if (!$source->getServer()->getAllowInvCheats() and !$source->isCreative()) { if (!$source->getFloatingInventory()->contains($droppedItem)) { return false; } $source->getFloatingInventory()->removeItem($droppedItem); } $source->dropItem($droppedItem); return true; }