Solved Potions with multiple effects?

Discussion in 'Plugin Development' started by Anonomoose, Mar 30, 2014.

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

    Anonomoose

    Hi all,

    Is it possible to create a potion that has multiple effects? For example, a potion that has Speed & Regen effects when used? I've tried this so far, but it only gives me the regen effect as that's the last one that's applied.

    Code:java
    1. ItemStack buffedPotion = new ItemStack(Material.POTION);
    2. Potion speedPot2 = new Potion(PotionType.SPEED, 2);
    3. Potion regenPot1 = new Potion(PotionType.REGEN, 1);
    4. speedPot2.apply(buffedPotion);
    5. regenPot1.apply(buffedPotion);


    Any other possible ideas/solutions?

    Thanks!
     
  2. Haven't tested:
    Code:
    ItemStack buffedPotion = new ItemStack(Material.POTION);
    PotionMeta potionMeta = (PotionMeta) buffedPotion.getItemMeta();
    potionMeta.addCustomEffect(x, false);
    potionMeta.addCustomEffect(y, false);
    buffedPotion.setItemMeta(potionMeta);
    
    I'm on my iPad so I don't if it would work.
     
  3. Offline

    Anonomoose

    I'll give it a shot now and let ya' know how it goes - thanks!

    EDIT: Worked perfectly - thanks a lot!
     
    KingFaris11 likes this.
  4. You're welcome. Please mark this thread as "Solved" so people don't waste their time looking xD
     
    Anonomoose and Gater12 like this.
Thread Status:
Not open for further replies.

Share This Page