Give splash potion and potion

Discussion in 'Plugin Development' started by Kenda, Aug 29, 2021.

  1. Offline


    Hi guys,

    I would create 2 methods for create my potion.
    Actuallay, I use ItemBuilder class ->

    But I can't create potion with this method.
    I create 2 method for 2 potion type (splash or not), but with the splash potion I can't choose the time for duration.

    /Can use the duration
        public ItemBuilder setPotion(PotionEffectType effect, int level, int duration) {
            PotionMeta meta = (PotionMeta) is.getItemMeta();
            meta.addCustomEffect(new PotionEffect(effect, (duration * 20), (level - 1)), true);
            return this;
        //Not here
        public static ItemStack setPotion(PotionType effectPotion, int level){
            Potion splash = new Potion(effectPotion, level);
            ItemStack potion = splash.toItemStack(1);
            ItemMeta meta = potion.getItemMeta();
            return potion;
    Can you help me ?
  2. Offline


    up ?

Share This Page