diff --git a/src/network/mcpe/InventoryManager.php b/src/network/mcpe/InventoryManager.php index d710d1271..b9cb99262 100644 --- a/src/network/mcpe/InventoryManager.php +++ b/src/network/mcpe/InventoryManager.php @@ -210,6 +210,15 @@ class InventoryManager{ if($action->sourceType !== NetworkInventoryAction::SOURCE_CONTAINER){ continue; } + + //legacy transactions should not modify or predict anything other than these inventories, since these are + //the only ones accessible when not in-game (ItemStackRequest is used for everything else) + if(match($action->windowId){ + ContainerIds::INVENTORY, ContainerIds::OFFHAND, ContainerIds::ARMOR => false, + default => true + }){ + throw new PacketHandlingException("Legacy transactions cannot predict changes to inventory with ID " . $action->windowId); + } $info = $this->locateWindowAndSlot($action->windowId, $action->inventorySlot); if($info === null){ continue; diff --git a/src/network/mcpe/handler/InGamePacketHandler.php b/src/network/mcpe/handler/InGamePacketHandler.php index b6b7c68be..80a0f2015 100644 --- a/src/network/mcpe/handler/InGamePacketHandler.php +++ b/src/network/mcpe/handler/InGamePacketHandler.php @@ -328,7 +328,7 @@ class InGamePacketHandler extends PacketHandler{ public function handleInventoryTransaction(InventoryTransactionPacket $packet) : bool{ $result = true; - if(count($packet->trData->getActions()) > 100){ + if(count($packet->trData->getActions()) > 50){ throw new PacketHandlingException("Too many actions in inventory transaction"); }