Make an itemstack form PotionEffect

Discussion in 'Plugin Development' started by RainoBoy97, May 3, 2013.

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

    RainoBoy97

    Hai!

    I want to create an ItemStack that corresponds to the right potion, I have the PotionEffect from the player.getActivePotionEffects and I want to create an ItemStack.

    I have tried
    Code:
    ItemStack potion = new ItemStack(Material.POTION, 1, (short) pe.getType().getId());
    
    But that gave me the wrong potions.

    Anyone know some solutions for this?

    Thanks - Raino
     
  2. Offline

    chasechocolate

  3. Offline

    alexlyn1

    wait

    How could i make like

    Potion potion = new Potion(PotionType.STRENGTH); how would i make it so it would be strength 2?
     
  4. Offline

    fromgate

    You just need to read JavaDoc, link provided by chasechocolate

    Potion(int name)
    Create a potion with a specific name.
    Potion(PotionType type)
    Construct a new potion of the given type.
    Potion(PotionType type, int level)
    Create a new potion of the given type and level.
     
Thread Status:
Not open for further replies.

Share This Page