Force-close the crafting window only when doing crafting transactions

otherwise the client will crash when using right-click on the recipe book
This commit is contained in:
Dylan K. Taylor
2017-10-03 11:33:09 +01:00
parent 9bbebaa071
commit ca401ec3f5
2 changed files with 17 additions and 15 deletions

View File

@ -50,20 +50,6 @@ class CraftingGrid extends BaseInventory{
}
public function sendContents($target) : void{
if(!is_array($target)){
$target = [$target];
}
/*
* TODO: HACK!
* we can't resend the contents of this window, so we force the client to close it instead.
* So people don't whine about messy desync issues when someone cancels CraftItemEvent, or when a crafting
* transaction goes wrong.
*/
$pk = new ContainerClosePacket();
$pk->windowId = ContainerIds::NONE;
foreach($target as $player){
$player->dataPacket($pk);
}
//no way to do this
}
}