Get Player that caused damage to EntityDamageEvent.getEntity()

Discussion in 'Plugin Development' started by RabidCrab, Aug 24, 2011.

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

    RabidCrab

    I'm looking for a way to get the player that shot/stabbed the victim of the EntityDamageEvent.

    Right now all I see are ways to get the types of damage done, like EntityDamageEvent.DamageCause.PROJECTILE, but I can't see how to cast that into a way to get the shooter of an arrow, or the swinger of a sword. Any ideas?
     
  2. Offline

    Zarius

    This post should be in PluginDevelopment, but check out this the example code post that uses projectile.getShooter().

    For more advanced usage also check out the code in OtherBlocks v2.0: in the entityListener here and ProjectileAgent here (note: code note yet fully tested).
     
    RabidCrab likes this.
  3. Offline

    RabidCrab

    Whoops, sorry about that.

    Thanks for the answer though, it works perfectly :D
     
Thread Status:
Not open for further replies.

Share This Page