Getting type of potion

Discussion in 'Plugin Development' started by Blackwing_Forged, Sep 24, 2017.

Thread Status:
Not open for further replies.
  1. I tried to do this but it returns WATER how do i get what type of potion the item is:

    Code:
    if ((item.getType() == Material.POTION))
    {
            Potion potion = Potion.fromItemStack(item);
            PotionType potionType = potion.getType();
            player.sendMessage(potionType.toString());
    }
     
  2. Offline

    Caderape2

    @Blackwing_Forged
    You need to cast the itemMeta of the itemstack to potionMeta. Then you should be able to retrieve the basePotionData
     
  3. I did this
    PotionMeta pm = (PotionMeta) item.getItemMeta();
    and i can't see basePotionData or anything similar
     
Thread Status:
Not open for further replies.

Share This Page