Solved add item

Discussion in 'Plugin Development' started by morha13, Jul 5, 2013.

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

    morha13

    Hello,
    how can i give player potion?
    like stone and grass....

    i have tried that:
    Code:java
    1. ItemStack po = new ItemStack(Material.SPEED);


    thank you!
     
  2. Offline

    GodzOfMadness

    morha13 To give a player a potion you need to have the id and it's data value attached. The ItemStack constructor takes 3 arguments to make it possible: Material, amount, data
    Here is an example of making an ItemStack to spawn a speed potion,
    ItemStack is = new ItemStack(Material.getMaterial(373), 1, (short)8194);
    373 is the id of the water bottle(you can use the enum instead if you want) and 8194 is the data attached for the speed potion(you can look at a id list and see the numbers after the : are 8194 for the speed potion)
     
  3. Offline

    morha13

    Thank You!!!
     
Thread Status:
Not open for further replies.

Share This Page