Finding player who left-clicked item frame

Discussion in 'Plugin Development' started by darkhelmet, Dec 30, 2013.

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

    darkhelmet

    Bukkit fires an EntityDamageEvent when a player left-clicks an item frame. However, the entity.getLastDamageCause() is null. I normally check:

    Code:
    if(entity.getLastDamageCause() instanceof EntityDamageByEntityEvent){
    but since it's null, I can't figure out how to tell who the damager is. Is this a bug or am I just missing something?

    Editing post not working. Just found the EntityDamageByEntityEvent - will try

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
  2. Offline

    Ronbo

    darkhelmet
    Try checking if the event itself is an instanceeof EntityDamageByEntityEvent, then cast it and use (event.getDamager() instanceof Player) rather than what you're doing right now.
     
Thread Status:
Not open for further replies.

Share This Page