Inventory: eliminate remaining $send parameters

This commit is contained in:
Dylan K. Taylor 2020-02-23 21:59:51 +00:00
parent 36685001bd
commit 7c2741e4f5
3 changed files with 8 additions and 10 deletions

View File

@ -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();
}
}

View File

@ -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{

View File

@ -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.