Prevent Player from getting damage from other player

Discussion in 'Plugin Development' started by bramhaag, Feb 16, 2014.

Thread Status:
Not open for further replies.
  1. Hi guys,
    It's me! I have a problem (again!), I'm want to create an event that prevent a player getting damage from an other player. Can someone please explain to me how to do this?
    Thanks,
    Bramhaag
     
  2. Offline

    Harmings

    bramhaag
    Cancel the EntityDamageByEntityEvent after checking if the entity is a player
     
  3. Offline

    tylersyme

    of course you will have to make sure that both the victim entity and the damager entity are players and not zombies or something.

    if (e.getEntity() instanceof Player && e.getDamager() instanceof Player) {
    //Cancel here
    }
     
Thread Status:
Not open for further replies.

Share This Page