Solved Giving a player a certain potion.

Discussion in 'Plugin Development' started by iReD_xBlaDeZ, Nov 21, 2015.

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

    iReD_xBlaDeZ

    Hello, I was wondering on how I would give a player an instant health potion. I know that 'Material.POTION' isn't the right thing and that there's something more. Anyone mind telling me? Thanks!

    Code:
    for(int i = 0; i < p.getInventory().getSize(); i++) {
                            p.getInventory().addItem(new ItemStack(Material.POTION));
                        }
     
  2. Offline

    Xerox262

    Code:
        ItemStack item = new ItemStack(Material.POTION);
        item.setDurability((short) 8229); // Healing 2
    To give the item a certain data just set the durability, for more potion ids go to http://minecraft.gamepedia.com/Potion#Potions_with_positive_effects
     
  3. Offline

    iReD_xBlaDeZ

  4. Offline

    Xerox262

    Don't forget to set the thread to solved :)
     
  5. Offline

    Abstract97

Thread Status:
Not open for further replies.

Share This Page