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:
Muqsit Rayyan 2017-05-30 15:27:47 +03:00 committed by Dylan K. Taylor
parent 1ed5de1d3b
commit 86f3b257a7

View File

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