Setting the shooter of a created explosion.

Discussion in 'Plugin Development' started by dibujaron, Sep 15, 2014.

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

    dibujaron

    Hey there!

    A part of a plugin that I work on deals with cannons. The cannons used to simply launch fireballs, but fireballs proved to be problematic so I switched to a custom projectile made with particle effects. When the projectile hits something, the plugin calls the createExplosion method of the world to simulate the projectile hitting.

    We have another plugin on our server that listens for PlayerDeathEvent and does things with the killer. When I used fireballs for my cannons plugin, I would call fireball's setShooter method to set the fireball's shooter to be the player that fired the cannon. Bukkit would set the PlayerDeathEvent's killer to be the fireball's shooter automatically behind the scenes, and all was well. Now that I use the created explosion, though, that functionality is no longer present. My projectile object knows who its shooter is, but that information does not translate through to the PlayerDeathEvent. There is no way to set the shooter of the Bukkit.createExplosion method.

    So my question is- given that the shooter of the projectile is easily available when it explodes, how can I set the PlayerDeathEvent's killer to be the projetile's shooter.

    Hope that made sense! All ideas are appreciated. I have vague ideas floating around in my head for some sort of caching solution but it seems inefficient and if multiple cannons go off very close to one another it may set the killer incorrectly. I'm very curious to see what you guys can come up with!
     
    moo3oo3oo3 likes this.
Thread Status:
Not open for further replies.

Share This Page