mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Improved safe_var_dump(), Inventory::addItem() Inventory::removeItem() using argument unpacking
This commit is contained in:
@ -225,9 +225,8 @@ abstract class BaseInventory implements Inventory{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function addItem(){
|
||||
public function addItem(...$slots){
|
||||
/** @var Item[] $slots */
|
||||
$slots = func_get_args();
|
||||
foreach($slots as $i => $slot){
|
||||
$slots[$i] = clone $slot;
|
||||
}
|
||||
@ -264,9 +263,8 @@ abstract class BaseInventory implements Inventory{
|
||||
return $slots;
|
||||
}
|
||||
|
||||
public function removeItem(){
|
||||
public function removeItem(...$slots){
|
||||
/** @var Item[] $slots */
|
||||
$slots = func_get_args();
|
||||
for($i = 0; $i < $this->getSize(); ++$i){
|
||||
$item = $this->getItem($i);
|
||||
if($item->getID() === Item::AIR){
|
||||
|
Reference in New Issue
Block a user