mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-17 04:06:54 +00:00
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:
@@ -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){
|
||||
|
Reference in New Issue
Block a user