title: Preventing damage to a specified player in Bukkit?
body: <p>I'm trying to make a command that allows you to make any player invulnerable -- that is, god mode. </p>
  
  <p>This is my code so far (though it's all boilerplate)</p>
  
  <pre><code>@EventHandler
  public void onEntityDamage(EntityDamageEvent event) {
      if(event.getEntity() instaceof Player) {
          if(godModed.containsKey(event.getPlayer())) {
              //This is where I need the code to go - something to cancel the damage.
          }
      }
  }
  </code></pre>
  
  <p><code>godModed</code> is a <code>HashMap godModed</code> which contains all the players who are currently godmoded. When they turn off godmode they are removed from the map.</p>
  
  <p>The command itself is working fine - I currently have it send a message to the player who triggered it, and I also have it add the player to godModed if they are not already on. However, I can't figure out how to actually prevent the damage to the player. I want to stop it completely, not just heal them back afterwards; while the latter might work, it could also lead to unforeseen consequences if other mods look at <code>onEntityDamage</code> to trigger things which a godmoded player shouldn't encounter.</p>