Adding Specified Potions To A GUI.

Discussion in 'Plugin Development' started by Entos6, Oct 11, 2014.

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

    Entos6

    Hey I'm making a simple GUI plugin for a small server and I can't figure out how to add certain potions to the GUI. I'm very new to Bukkit and coding in general. Anything would help!

    Code:
            ItemStack pot1 = new ItemStack(Material.POTION);
    The code shows the way I find easiest to enter the items into the gui. If it can be done this way I would prefer it. Thanks for the help!
     
  2. Offline

    mine-care

    373:16421 is the I'd of a potion, to put it is new itemstack(Material.POTION,(short) 16421);
    =)
     
  3. Offline

    Entos6

    Care to explain what short means?
     
  4. Offline

    Code0

    It's a "short" number. Where int is a "normal" number and a "long" is a long number. Pretty self-explanatory. <- All without decimals.

    And just so you know, you change the potion type by setting it's damage value. Entos6
     
    mine-care likes this.
  5. Offline

    MomsKnife

    new ItemStack(Material.<mat>, <amount>, (short) <data>);
     
  6. Offline

    Entos6

    So for example a strength potions that is extended (373:8217), would be

    Code:
    ItemStack potion = new ItemStack(Material.POTION, 1, (short) 8217);


    & thanks a ton it worked great! [SOLVED]

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  7. Offline

    SeniorCluckers

    Entos6
    Mark as solved pluz!
     
    mine-care likes this.
  8. Offline

    97WaterPolo

    Entos6
    Just as a reference for the future, you can also make a potion using the following.

    ItemStack p = new Potion(PotionType type, Tier tier, Boolean splash, Boolean extended).toItemStack(amount);

    A bit longer, but always an alternative as I personally like to know what the potion is, and I am to lazy to check the data :p
     
Thread Status:
Not open for further replies.

Share This Page