Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler(priority = EventPriority.LOWEST)
- public void onEntityDamageByEntity(final EntityDamageByEntityEvent edbe) {
- double newHealthRatio = (((LivingEntity) edbe.getEntity())
- .getMaxHealth() - edbe.getDamage())
- / ((LivingEntity) edbe.getEntity()).getMaxHealth();
- // Check if mob is a monster, but not a wither (EnderDragon is not
- // Monster)
- // and that new health of mob is <15%
- // and that player has proper Fate level
- if (edbe.getEntity() instanceof Monster
- && newHealthRatio > 0
- && newHealthRatio < 0.15
- && !(edbe.getEntity() instanceof Wither)
- && faithMap.get(edbe.getDamager().getUniqueId())
- .checkEquippedFaithLevel("Fate",
- Faith.FATE_INEVITABLE_DEMISE_LEVEL)) {
- faithMap.get(edbe.getDamager().getUniqueId())
- .castFate_InevitableDemise(
- edbe.getDamager().getUniqueId(),
- ((Player) edbe.getDamager()),
- ((LivingEntity) edbe.getEntity()));
- }
- // Check if entity is a PLAYER
- // and that new health of player is 0
- // and that player has proper Fate level
- if (edbe.getEntity() instanceof Player
- && (edbe.getDamage() > ((Player) edbe.getEntity()).getHealth())
- && faithMap.get(((Player) edbe.getEntity()).getUniqueId())
- .checkEquippedFaithLevel("Time",
- Faith.TIME_REWIND_LEVEL)) {
- faithMap.get(((Player) edbe.getEntity()).getUniqueId()).castTime_Rewind(
- ((Player) edbe.getEntity()));
- edbe.setCancelled(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment