Making a material.potion a splash potion..

Discussion in 'Plugin Development' started by HyKurtis, Aug 8, 2015.

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

    HyKurtis

    I'm trying to make this a splash potion! How do i do it?

    Code:
        @EventHandler
        public void onEntityDeathThree(EntityDeathEvent event) {
            Random random = new Random();
            int itemChance = random.nextInt(2);
            if(itemChance == 0) {
                if(event.getEntity() instanceof Zombie) {
                    ItemStack hungerpotion = new ItemStack(Material.POTION, 1);
                    PotionMeta meta = (PotionMeta) hungerpotion.getItemMeta();
                    meta.addCustomEffect(new PotionEffect(PotionEffectType.HUNGER, 100, 100), true);
                    meta.setDisplayName("§4Splash Potion of Hunger");
                    meta.setLore(Arrays.asList("§fRight-click this to starve the people in the effected area."));
                    hungerpotion.setItemMeta(meta);
                    event.getEntity().getWorld().dropItem(event.getEntity().getLocation(), hungerpotion);
                }
            }else {
                if(event.getEntity() instanceof Spider) {
                }
            }
        }

    I ACTUALLY SOLVED THIS MYSELF BUT THANKS FOR READING :) I DON'T KNOW HOW TO MAKE THIS SOLVED..
     
    Last edited: Aug 8, 2015
  2. Offline

    AcePilot10

Thread Status:
Not open for further replies.

Share This Page