Always evacuate the crafting grid on close, no matter whether it's big or not

otherwise items will get deleted and people will cry
This commit is contained in:
Dylan K. Taylor 2017-09-16 21:58:10 +01:00
parent 8dc3d019f6
commit 0f37bc35ba

View File

@ -3738,12 +3738,17 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
public function resetCraftingGridType() : void{ public function resetCraftingGridType() : void{
if($this->craftingGrid instanceof BigCraftingGrid){ $contents = $this->craftingGrid->getContents();
$drops = $this->inventory->addItem(...$this->craftingGrid->getContents()); if(count($contents) > 0){
$drops = $this->inventory->addItem(...$contents);
foreach($drops as $drop){ foreach($drops as $drop){
$this->dropItem($drop); $this->dropItem($drop);
} }
$this->craftingGrid->clearAll();
}
if($this->craftingGrid instanceof BigCraftingGrid){
$this->craftingGrid = new CraftingGrid($this); $this->craftingGrid = new CraftingGrid($this);
$this->craftingType = 0; $this->craftingType = 0;
} }