Getting ItemInHand for Damager on EntityDamageByEntityEvent?

Discussion in 'Plugin Development' started by CandyCranium, Apr 22, 2014.

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

    CandyCranium

    I'm currently trying to manipulate getting the iteminhand from the damager in an EntityDamageByEntityEvent, but e.getDamager().getItemInHand() doesn't seem to be an option. I know there's possibly an easy way to do this, but my brain is just dead right now, and I can't seem to find a solution. Any help?
     
  2. Offline

    DxDy

    You need to check whether the Damager (getDamager()) is an instanceof Player. If this is true, you can cast the Entity into a Player and use getItemInHand() ;)
     
  3. Offline

    CandyCranium

    DxDy
    Ah, thank you. And please, excuse my brain death. >.<
     
Thread Status:
Not open for further replies.

Share This Page