mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +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:
@ -79,11 +79,6 @@ class SlotChangeAction extends InventoryAction{
|
||||
* Sets the item into the target inventory.
|
||||
*/
|
||||
public function execute(Player $source) : void{
|
||||
$this->inventory->setItem($this->inventorySlot, $this->targetItem, false);
|
||||
foreach($this->inventory->getViewers() as $viewer){
|
||||
if($viewer !== $source){
|
||||
$viewer->getNetworkSession()->getInvManager()->syncSlot($this->inventory, $this->inventorySlot);
|
||||
}
|
||||
}
|
||||
$this->inventory->setItem($this->inventorySlot, $this->targetItem);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user