mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 18:29:46 +00:00
Remove unneeded foreach loop in Human::getDrops() (#941)
* Remove unneeded foreach loop in Human::getDrops() * Use array_values() for backwards compatibility.
This commit is contained in:
parent
1ed5de1d3b
commit
86f3b257a7
@ -425,14 +425,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
}
|
||||
|
||||
public function getDrops(){
|
||||
$drops = [];
|
||||
if($this->inventory !== null){
|
||||
foreach($this->inventory->getContents() as $item){
|
||||
$drops[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
return $drops;
|
||||
return $this->inventory !== null ? array_values($this->inventory->getContents()) : [];
|
||||
}
|
||||
|
||||
public function saveNBT(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user