EntityDamageByEntity, if both players, get what one is holding

Discussion in 'Plugin Development' started by frozenpoptartmc, May 25, 2013.

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

    frozenpoptartmc

    Code:java
    1.  
    2. @EventHandler
    3. public void onEDBEE(EntityDamageByEntityEvent event){
    4. if(event.getDamager() instanceof Player){
    5. if(event.getDamager().getItemInHand().getType() == Material.ROTTEN_FLESH){
    6. //do stuff
    7. }
    8. }
    9. }
    10.  

    doesn't seem to work.
    casting it to a humanentity seems too easy, but if that's what i have to do, then okay.
     
  2. Offline

    caseif

    Yeah, I think you'll need to cast it to a Player or a HumanEntity, then call .getItemInHand().
     
Thread Status:
Not open for further replies.

Share This Page