1 step is foreach through the player's inventory contents using foreach($player->getContents() as $item){}