mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-02 08:39:49 +01:00
Updating onEntityDamageByEntity event listener
This commit is contained in:
parent
882a457484
commit
4f2a0b8260
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user