[SOLVED] Player attacking entity

Discussion in 'Plugin Development' started by ACTruncale, Apr 3, 2011.

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

    ACTruncale

    What method would use to capture the event: A player attacks another entity. ?

    Would it be the EntityDamageByEntityEvent? If so how do I check to see if the entity is a player not a monster?
     
  2. Offline

    Crash

    Yeah you use EntityDamageByEntity
    To check if it's a player use :
    Code:
    if(entity instanceof Player){
    
        //It's a player
    
    }
     
  3. Offline

    ACTruncale

    figured it out:
    event.getEntity() instanceof Player

    lol thanks

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 13, 2016
Thread Status:
Not open for further replies.

Share This Page