mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-04 08:56:15 +00:00
Constrain inventory transaction predictions
these are now only used for actions done with a closed inventory window. This means that they can only predict the slots of inventory, offhand and armor (total 41 slots) and perhaps include some DropItem actions.
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user