Solved How to check who hit a player?

Discussion in 'Plugin Development' started by rocket138, Dec 5, 2013.

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

    rocket138

    So I'm making a tag plugin, and I wan't to be able to check who was hit and who hit the player.
    I tried EntityDamageByEntityEvent, but I'm struggling to get the actual player names and such.
     
  2. Offline

    Wolfey

    This isn't the right place, but do this:

    Code:
    @EventHandler
    public void onDamage(EntityDamageByEntityEvent e) {
    if(e.getEntity() instanceof Player && e.getDamager() instanceof Player) {
    Player victim = (Player) e.getEntity();
    Player damager = (Player) e.getDamager();
    // do stuff
    }
    }
    
    np98765 , mbaxter can you please move this to the right place, doesn't seem like it is.
     
  3. Offline

    np98765

    Moved to Plugin Development.

    Next time, please use the report button -- it will notify all staff members and is more efficient :)
     
    Wolfey likes this.
  4. Offline

    rocket138

    Woops, sorry must've clicked on the wrong subforum thing.
     
  5. Offline

    Wolfey

    Also this is completely offtopic, and i'll delete it later, but how many posts do I have to make for it not to be approvable anymore?
     
Thread Status:
Not open for further replies.

Share This Page