Set Potion Type?

Discussion in 'Plugin Development' started by zakarls, Jun 16, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    zakarls

    How would I set the potion type when adding it to a players inventory. Ive tried
    Code:java
    1. player.getInventory().addItem(Material.Potion(PotionEffectType.HEAL)) ;

    because that was all I could find on various google searches and it did not work. Any help would be greatly appreciated. Thanks.
     
  2. Offline

    Go Hard

    zakarls
    Code:java
    1. p.getInventory().addItem(new ItemStack(Material.POTION, 1, (short) 8193));


    You can get the potions ID's from this page: ID's Page

    Scroll down to the potions ID's You need the second number in the potions ID. For example.




    ID : 373:8193 - Regeneration Potion (0:45)


    You want the number thats bolded. You would put that number where it is above on the code.
     
  3. Offline

    Laxer21117

    Code:java
    1. e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 200, 1));


    Sorry if I am answering incorrectly but this is how I add potion effects to a player.
     
  4. Offline

    Go Hard

    Laxer21117 He's trying to add the potion to the players inventory. Not to the player directly
     
  5. Offline

    zakarls

Thread Status:
Not open for further replies.

Share This Page