ItemStackRequestExecutor: added some missing @throws

This commit is contained in:
Dylan K. Taylor 2023-03-21 00:23:31 +00:00
parent c8d9477da1
commit 1a9322c00a
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -129,6 +129,9 @@ class ItemStackRequestExecutor{
return [$this->builder->getInventory($inventory), $slot]; return [$this->builder->getInventory($inventory), $slot];
} }
/**
* @throws ItemStackRequestProcessException
*/
protected function transferItems(ItemStackRequestSlotInfo $source, ItemStackRequestSlotInfo $destination, int $count) : void{ protected function transferItems(ItemStackRequestSlotInfo $source, ItemStackRequestSlotInfo $destination, int $count) : void{
$removed = $this->removeItemFromSlot($source, $count); $removed = $this->removeItemFromSlot($source, $count);
$this->addItemToSlot($destination, $removed, $count); $this->addItemToSlot($destination, $removed, $count);
@ -159,6 +162,7 @@ class ItemStackRequestExecutor{
/** /**
* Adds items to the target slot, if they are stackable. * Adds items to the target slot, if they are stackable.
* @throws ItemStackRequestProcessException
*/ */
protected function addItemToSlot(ItemStackRequestSlotInfo $slotInfo, Item $item, int $count) : void{ protected function addItemToSlot(ItemStackRequestSlotInfo $slotInfo, Item $item, int $count) : void{
$this->requestSlotInfos[] = $slotInfo; $this->requestSlotInfos[] = $slotInfo;
@ -242,6 +246,9 @@ class ItemStackRequestExecutor{
} }
} }
/**
* @throws ItemStackRequestProcessException
*/
protected function takeCreatedItem(ItemStackRequestSlotInfo $destination, int $count) : void{ protected function takeCreatedItem(ItemStackRequestSlotInfo $destination, int $count) : void{
if($count < 1){ if($count < 1){
//this should be impossible at the protocol level, but in case of buggy core code this will prevent exploits //this should be impossible at the protocol level, but in case of buggy core code this will prevent exploits