Solved Potion Levels/Tiers

Discussion in 'Plugin Development' started by Markyroson, Jun 28, 2015.

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

    Markyroson

    I tried creating a potion for my inventory GUI that is level/tier II (2) healing, the issue is that I can only seem to get it to level one. Any ideas?

    Thanks in advance! :)

    My code so far:

    Code:
    Potion potionHealing = new Potion(PotionType.INSTANT_HEAL);
                ItemStack stack = potionHealing.toItemStack(1);
                inventory.setItem(8, stack);
     
  2. Offline

    Ward1246

    Try this: Potion potionHealing = new Potion(PotionType.INSTANT_HEAL, 2);
    Untested. Sorry if it doesn't work, but AFAIK the arguments for the new potion are (PotionType, int) so I am guessing the int part means the amplifier.
     
    Markyroson likes this.
  3. Offline

    Markyroson

    You are correct, thank you! :)

    JavaDoc connected says:
    Code:
    org.bukkit.potion.Potion.Potion(PotionType type, int level)
     
  4. Offline

    Ward1246

    Glad I could help! Even better I got it right on the first time :D
     
    Markyroson likes this.
  5. Offline

    Markyroson

    yup! :)
     
Thread Status:
Not open for further replies.

Share This Page