Updating onEntityDamageByEntity event listener

This commit is contained in:
nossr50 2012-03-02 09:35:52 -08:00
parent 882a457484
commit 4f2a0b8260

View File

@ -75,7 +75,21 @@ public class mcEntityListener implements Listener
event.setCancelled(true); event.setCancelled(true);
} }
Combat.combatChecks(event, plugin); //Check for mcgod mode
if(defender instanceof Player)
{
Player playerDefender = (Player)defender;
if(Users.getProfile(playerDefender).getGodMode())
event.setCancelled(true);
}
//Make sure defender is not invincible
if(defender instanceof LivingEntity)
{
LivingEntity livingDefender = (LivingEntity)defender;
if(livingDefender.getNoDamageTicks() < livingDefender.getMaximumNoDamageTicks()/2.0F)
Combat.combatChecks(event, plugin);
}
} }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)