Detecting Arrow Shot

Discussion in 'Plugin Development' started by Intelli, Feb 4, 2011.

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

    Intelli

    Hey everyone,

    Is there a way to detect if you're hit by an arrow that was shot by another player?
    I haven't had much luck with this.

    Thanks!
     
  2. Offline

    Redecouverte

    EntityListener has EntityDamageByProjectileEvent.getDamager(), though i did not test it yet
     
  3. Offline

    Guybrush

    if (event.getDamager() instanceof Player) {
    //Place code here
    }
     
  4. Offline

    8e8

    Before checking if it was a Player, you'd want to do this:
    if(event.getProjectile() instanceof Arrow) {
    // Check if Player
    }
     
Thread Status:
Not open for further replies.

Share This Page