Bukkit - Firework Trail Effects as Passengers for projectiles (arrows/snowballs)

Discussion in 'Plugin Development' started by Charliebiff05, Dec 27, 2020.

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

    Charliebiff05

    This is what I have coded so far I am confused I would love and have some help with this. thanks guys and for all you do!

    - I would like to add a firewor passenger with a detonation effect that follows the snowball projectile. I cant wrap my head round it. cheers agin

    //START OF CODE

    @EventHandler (priority = EventPriority.NORMAL)
    public void onFrostcall001hit (EntityDamageByEntityEvent event) {
    if (event.getDamager() instanceof Player ) { //If is player with sword
    Player attacker = (Player) event.getDamager();
    LivingEntity damaged = (LivingEntity) event.getEntity();

    if (attacker.getInventory().getItemInMainHand().getItemMeta().getLore().contains(ChatColor.WHITE + "Special: " + ChatColor.GRAY + "Frost Call I ")) { //If the attacker is wielding a diamond sword, you can customize this to any thing you want
    //PotionEffect potionEffect = new PotionEffect(PotionEffectType.WEAKNESS, 90, 0); //Replace this with your potion effect of choice
    Random rand = new Random();
    int number = rand.nextInt(100) + 1;
    if(number >= 75) { //25%
    //Your code here
    //Your code here
    //potionEffect.apply(damaged); //Apply the potion effect
    //Soul Arrow summon

    attacker.launchProjectile(Snowball.class);


    attacker.sendMessage(ChatColor.DARK_AQUA + (ChatColor.BOLD + "* Summoned Frostball *"));
    damaged.sendMessage(ChatColor.DARK_AQUA + (ChatColor.BOLD + "* Ffrostball has been summoned by Foe *"));
    } else {
    attacker.sendMessage(ChatColor.DARK_AQUA + (ChatColor.BOLD + "* Failed to Summon Frostball *"));
    }
    }
    }
    }
    //END OF CODE


    I am aware of the following:

    snwball.addPassenger(f);
    f.detonate()

    but do not know how to have a loop of the effect trailing the snowball when launched....

    Thanks again for any help.
    ~
     
    Last edited: Dec 27, 2020
Thread Status:
Not open for further replies.

Share This Page