InventoryManager: be aware of client-side state when syncing slots

this eliminates feedback loops during client-initiated slot changes, and also makes it possible to have a SlotChangeAction anonymous from its initiator.
This commit is contained in:
Dylan K. Taylor
2020-02-11 21:12:18 +00:00
parent cd71a6204f
commit 4014f9a4f2
3 changed files with 29 additions and 7 deletions

View File

@@ -245,6 +245,7 @@ class InGamePacketHandler extends PacketHandler{
if($isFinalCraftingPart){
try{
$this->session->getInvManager()->onTransactionStart($this->craftingTransaction);
$this->craftingTransaction->execute();
}catch(TransactionValidationException $e){
$this->session->getLogger()->debug("Failed to execute crafting transaction: " . $e->getMessage());
@@ -267,6 +268,7 @@ class InGamePacketHandler extends PacketHandler{
}
$transaction = new InventoryTransaction($this->player, $actions);
$this->session->getInvManager()->onTransactionStart($transaction);
try{
$transaction->execute();
}catch(TransactionValidationException $e){