mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-27 15:52:46 +00:00
Inventory: eliminate remaining $send parameters
This commit is contained in:
parent
36685001bd
commit
7c2741e4f5
@ -98,6 +98,6 @@ trait ContainerTrait{
|
|||||||
foreach($inv->getContents() as $k => $item){
|
foreach($inv->getContents() as $k => $item){
|
||||||
$pos->world->dropItem($pos->add(0.5, 0.5, 0.5), $item);
|
$pos->world->dropItem($pos->add(0.5, 0.5, 0.5), $item);
|
||||||
}
|
}
|
||||||
$inv->clearAll(false);
|
$inv->clearAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ abstract class BaseInventory implements Inventory{
|
|||||||
/**
|
/**
|
||||||
* @param Item[] $items
|
* @param Item[] $items
|
||||||
*/
|
*/
|
||||||
public function setContents(array $items, bool $send = true) : void{
|
public function setContents(array $items) : void{
|
||||||
if(count($items) > $this->getSize()){
|
if(count($items) > $this->getSize()){
|
||||||
$items = array_slice($items, 0, $this->getSize(), true);
|
$items = array_slice($items, 0, $this->getSize(), true);
|
||||||
}
|
}
|
||||||
@ -112,12 +112,10 @@ abstract class BaseInventory implements Inventory{
|
|||||||
$listener->onContentChange($this);
|
$listener->onContentChange($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($send){
|
|
||||||
foreach($this->getViewers() as $viewer){
|
foreach($this->getViewers() as $viewer){
|
||||||
$viewer->getNetworkSession()->getInvManager()->syncContents($this);
|
$viewer->getNetworkSession()->getInvManager()->syncContents($this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function setItem(int $index, Item $item) : void{
|
public function setItem(int $index, Item $item) : void{
|
||||||
if($item->isNull()){
|
if($item->isNull()){
|
||||||
@ -317,8 +315,8 @@ abstract class BaseInventory implements Inventory{
|
|||||||
$this->setItem($index, ItemFactory::air());
|
$this->setItem($index, ItemFactory::air());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function clearAll(bool $send = true) : void{
|
public function clearAll() : void{
|
||||||
$this->setContents([], $send);
|
$this->setContents([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function swap(int $slot1, int $slot2) : void{
|
public function swap(int $slot1, int $slot2) : void{
|
||||||
|
@ -80,7 +80,7 @@ interface Inventory{
|
|||||||
/**
|
/**
|
||||||
* @param Item[] $items
|
* @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.
|
* Checks if the inventory contains any Item with the same material data.
|
||||||
@ -127,7 +127,7 @@ interface Inventory{
|
|||||||
/**
|
/**
|
||||||
* Clears all the slots
|
* Clears all the slots
|
||||||
*/
|
*/
|
||||||
public function clearAll(bool $send = true) : void;
|
public function clearAll() : void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swaps the specified slots.
|
* Swaps the specified slots.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user