OKAY. first of all, you literally post the same THREAD 3 TIMES. You'll get answers don't worry. But this is not gonna work. Instead you got an answer, you got a warn.
Use Inventory->getContents() to get all the items from the inventory, then just check if any of them are potions with a simple loop.
Sorry for late, PHP: foreach($player->getInventory()->getContents as $item){ if($item->getId() === /*id of potion*/ and $item->getDamage() === /*meta of potion*/){ //do ur code ect.. }} Im really, really not sure this works, im phone, im bored ect... i just thinked something and ye, just test it and tell me if it works