From 0f37bc35ba58a63132db8bb196011de8aade41e7 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 16 Sep 2017 21:58:10 +0100 Subject: [PATCH] Always evacuate the crafting grid on close, no matter whether it's big or not otherwise items will get deleted and people will cry --- src/pocketmine/Player.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 00b6bd984c..b76957bb18 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -3738,12 +3738,17 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ } public function resetCraftingGridType() : void{ - if($this->craftingGrid instanceof BigCraftingGrid){ - $drops = $this->inventory->addItem(...$this->craftingGrid->getContents()); + $contents = $this->craftingGrid->getContents(); + if(count($contents) > 0){ + $drops = $this->inventory->addItem(...$contents); foreach($drops as $drop){ $this->dropItem($drop); } + $this->craftingGrid->clearAll(); + } + + if($this->craftingGrid instanceof BigCraftingGrid){ $this->craftingGrid = new CraftingGrid($this); $this->craftingType = 0; }