Solved Arrows

Discussion in 'Plugin Development' started by Ghilliedrone, Jul 30, 2013.

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

    Ghilliedrone

    I'm trying to find when a player gets shot by an arrow, who the player is and who shot the arrow. I've tried EntityDamageByEntityEvent but it says the arrow is who shot the player. Does anyone know how i would check this?
     
  2. Offline

    Tomskied

    If you get that Arrow, you can use arrow.getShooter() to check who shot it! Could be a player, could be a skeleton!?

    Code:java
    1.  
    2. if(e.getDamager() instanceof Arrow){
    3. Arrow a = (Arrow)e.getDamager();
    4. if(a.getShooter() instanceof Player){
    5. Player p = (Player)a.getShooter();
    6. }
    7. }
     
    Ghilliedrone likes this.
  3. Offline

    Rocoty

    You can invoke getShooter() on the arrow to get the player who shot it.

    EDIT: I was eaten by the cookie monster
     
    Tomskied likes this.
Thread Status:
Not open for further replies.

Share This Page