Canceling Player Damage

Discussion in 'Plugin Development' started by HeadGam3z, Jun 3, 2014.

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

    HeadGam3z

    If I wanted to cancel player damage from other players (disable PvP), what event would you guys recommend I use? I thought about the EntityDamageEvent, what do you think?
     
  2. Offline

    Fhbgsdhkfbl

  3. Offline

    supersonicsauce

    HeadGam3z
    I'm not using an IDE currently, so I can't write anything for you, but I would use EntityDamageByEntity and then, inside the right if(….) condition, do event.setCancelled()
     
  4. Offline

    Not2EXceL

    check entity player
     
  5. Offline

    MrTheoker

    Code:java
    1. @EventHandler
    2. public void onPlayerDamage(EntityDamageEvent e)
    3. {
    4. if (e.getEntity() instanceof Player)
    5. {
    6. e.setCancelled(true);
    7. }
    8. }
     
Thread Status:
Not open for further replies.

Share This Page