mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +00:00
Force-close the inventory window when crafting fails to avoid desync issues
mojang, why does this have to be hard work
This commit is contained in:
@ -2297,7 +2297,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
if($this->craftingTransaction->getPrimaryOutput() !== null){
|
||||
//we get the actions for this in several packets, so we can't execute it until we get the result
|
||||
|
||||
$this->craftingTransaction->execute(); //if it can't execute, no inventories will be modified
|
||||
$this->craftingTransaction->execute();
|
||||
$this->craftingTransaction = null;
|
||||
}
|
||||
|
||||
@ -2312,16 +2312,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
$transaction = new InventoryTransaction($this, $actions);
|
||||
|
||||
if(!$transaction->execute()){
|
||||
foreach($transaction->getInventories() as $inventory){
|
||||
$inventory->sendContents($this);
|
||||
if($inventory instanceof PlayerInventory){
|
||||
$inventory->sendArmorContents($this);
|
||||
}
|
||||
}
|
||||
|
||||
$this->server->getLogger()->debug("Failed to execute inventory transaction from " . $this->getName() . " with actions: " . json_encode($packet->actions));
|
||||
|
||||
//TODO: check more stuff that might need reversion
|
||||
return false; //oops!
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user