From 7c2741e4f57412f1ad553950058acccac23e0fdc Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 23 Feb 2020 21:59:51 +0000 Subject: [PATCH] Inventory: eliminate remaining $send parameters --- src/block/tile/ContainerTrait.php | 2 +- src/inventory/BaseInventory.php | 12 +++++------- src/inventory/Inventory.php | 4 ++-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/block/tile/ContainerTrait.php b/src/block/tile/ContainerTrait.php index 2acc3ea80..f3386a207 100644 --- a/src/block/tile/ContainerTrait.php +++ b/src/block/tile/ContainerTrait.php @@ -98,6 +98,6 @@ trait ContainerTrait{ foreach($inv->getContents() as $k => $item){ $pos->world->dropItem($pos->add(0.5, 0.5, 0.5), $item); } - $inv->clearAll(false); + $inv->clearAll(); } } diff --git a/src/inventory/BaseInventory.php b/src/inventory/BaseInventory.php index 66614c458..57e3d199b 100644 --- a/src/inventory/BaseInventory.php +++ b/src/inventory/BaseInventory.php @@ -85,7 +85,7 @@ abstract class BaseInventory implements Inventory{ /** * @param Item[] $items */ - public function setContents(array $items, bool $send = true) : void{ + public function setContents(array $items) : void{ if(count($items) > $this->getSize()){ $items = array_slice($items, 0, $this->getSize(), true); } @@ -112,10 +112,8 @@ abstract class BaseInventory implements Inventory{ $listener->onContentChange($this); } - if($send){ - foreach($this->getViewers() as $viewer){ - $viewer->getNetworkSession()->getInvManager()->syncContents($this); - } + foreach($this->getViewers() as $viewer){ + $viewer->getNetworkSession()->getInvManager()->syncContents($this); } } @@ -317,8 +315,8 @@ abstract class BaseInventory implements Inventory{ $this->setItem($index, ItemFactory::air()); } - public function clearAll(bool $send = true) : void{ - $this->setContents([], $send); + public function clearAll() : void{ + $this->setContents([]); } public function swap(int $slot1, int $slot2) : void{ diff --git a/src/inventory/Inventory.php b/src/inventory/Inventory.php index 8bb958676..adbd26c1d 100644 --- a/src/inventory/Inventory.php +++ b/src/inventory/Inventory.php @@ -80,7 +80,7 @@ interface Inventory{ /** * @param Item[] $items */ - public function setContents(array $items, bool $send = true) : void; + public function setContents(array $items) : void; /** * Checks if the inventory contains any Item with the same material data. @@ -127,7 +127,7 @@ interface Inventory{ /** * Clears all the slots */ - public function clearAll(bool $send = true) : void; + public function clearAll() : void; /** * Swaps the specified slots.