Java Code Examples for org.bukkit.event.entity.EntityDamageByEntityEvent#isCancelled()
The following examples show how to use
org.bukkit.event.entity.EntityDamageByEntityEvent#isCancelled() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QAListener.java From QualityArmory with GNU General Public License v3.0 | 6 votes |
@SuppressWarnings("deprecation") @EventHandler public void onHit(EntityDamageByEntityEvent e) { if (e.isCancelled()) return; if (e.getDamager() instanceof Player) { Player d = (Player) e.getDamager(); if ((e.getCause() == DamageCause.ENTITY_ATTACK || e.getCause() == DamageCause.ENTITY_SWEEP_ATTACK)) { if (QualityArmory.isMisc(d.getItemInHand())) { CustomBaseObject aa = QualityArmory.getMisc(d.getItemInHand()); if (aa instanceof MeleeItems) { DEBUG("Setting damage for " + aa.getName() + " to be equal to " + ((MeleeItems) aa).getDamage() + ". was " + e.getDamage()); e.setDamage(((MeleeItems) aa).getDamage()); } if (aa.getSoundOnHit() != null) { e.getEntity().getWorld().playSound(e.getEntity().getLocation(), aa.getSoundOnHit(), 1, 1); } } } if (QualityArmory.isGun(d.getItemInHand()) || QualityArmory.isIronSights(d.getItemInHand())) DEBUG("The player " + e.getEntity().getName() + " was Hit with a gun! Damage=" + e.getDamage()); } }
Example 2
Source File: SentinelTrait.java From Sentinel with MIT License | 6 votes |
/** * Called when this sentinel gets attacked, to correct the armor handling. */ public void whenAttacksAreHappeningToMe(EntityDamageByEntityEvent event) { if (event.isCancelled()) { return; } if (!getNPC().isSpawned()) { return; } double armorLevel = getArmor(getLivingEntity()); if (hitIsBlocked(event.getDamager())) { armorLevel = (1.0 - armorLevel) * 0.5 + armorLevel; } if (!event.isApplicable(EntityDamageEvent.DamageModifier.ARMOR)) { event.setDamage(EntityDamageEvent.DamageModifier.BASE, (1.0 - armorLevel) * event.getDamage(EntityDamageEvent.DamageModifier.BASE)); } else { event.setDamage(EntityDamageEvent.DamageModifier.ARMOR, -armorLevel * event.getDamage(EntityDamageEvent.DamageModifier.BASE)); } for (EntityDamageEvent.DamageModifier modifier : modifiersToZero) { if (event.isApplicable(modifier)) { event.setDamage(modifier, 0); } } }
Example 3
Source File: PreventEndermanHeightExploit.java From EliteMobs with GNU General Public License v3.0 | 6 votes |
@EventHandler (priority = EventPriority.HIGHEST) public void onDamage(EntityDamageByEntityEvent event){ if (event.isCancelled()) return; if (!event.getEntity().getType().equals(EntityType.ENDERMAN)) return; EntityType entityType = EntityFinder.getRealDamager(event).getType(); if (entityType == null) return; if (!entityType.equals(EntityType.PLAYER)) return; EliteMobEntity eliteMobEntity = EntityTracker.getEliteMobEntity(event.getEntity()); if (eliteMobEntity == null) return; Block block = EntityFinder.getRealDamager(event).getLocation().getBlock().getLocation().add(new Vector(0, 2, 0)).getBlock(); if (block.getType().equals(Material.AIR) || block.getType().equals(Material.WATER)) return; eliteMobEntity.setHasSpecialLoot(false); AntiExploitMessage.sendWarning((LivingEntity) event.getEntity()); }
Example 4
Source File: SlimefunBootsListener.java From Slimefun4 with GNU General Public License v3.0 | 6 votes |
private void stomp(EntityDamageEvent e) { Player p = (Player) e.getEntity(); p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR, 1F, 2F); p.setVelocity(new Vector(0.0, 0.7, 0.0)); for (Entity n : p.getNearbyEntities(4, 4, 4)) { if (n instanceof LivingEntity && !n.getUniqueId().equals(p.getUniqueId())) { Vector velocity = n.getLocation().toVector().subtract(p.getLocation().toVector()).normalize().multiply(1.4); n.setVelocity(velocity); if (!(n instanceof Player) || (p.getWorld().getPVP() && SlimefunPlugin.getProtectionManager().hasPermission(p, n.getLocation(), ProtectableAction.PVP))) { EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(p, n, DamageCause.ENTITY_ATTACK, e.getDamage() / 2); Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) ((LivingEntity) n).damage(e.getDamage() / 2); } } } for (BlockFace face : BlockFace.values()) { Block b = p.getLocation().getBlock().getRelative(BlockFace.DOWN).getRelative(face); p.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getType()); } }
Example 5
Source File: Kraken.java From EliteMobs with GNU General Public License v3.0 | 6 votes |
@EventHandler public void fireballDamage(EntityDamageByEntityEvent event) { if (event.isCancelled()) return; if (!event.getEntity().getType().equals(EntityType.PLAYER)) return; if (!event.getDamager().getType().equals(EntityType.FIREBALL)) return; if (!isFireball((Fireball) event.getDamager())) return; for (EntityDamageByEntityEvent.DamageModifier modifier : EntityDamageByEntityEvent.DamageModifier.values()) if (event.isApplicable(modifier)) event.setDamage(modifier, 0); event.setDamage(EntityDamageEvent.DamageModifier.BASE, 2); removeFireball((Fireball) event.getDamager()); }
Example 6
Source File: NoEntryListener.java From CombatLogX with GNU General Public License v3.0 | 6 votes |
@EventHandler(priority=EventPriority.HIGHEST) public void onCancelPVP(EntityDamageByEntityEvent e) { if(!e.isCancelled()) return; if(this.expansion.getNoEntryHandler().getNoEntryMode() != NoEntryMode.VULNERABLE) return; Entity entity = e.getEntity(); if(!(entity instanceof Player)) return; ICombatLogX plugin = this.expansion.getPlugin(); ICombatManager manager = plugin.getCombatManager(); Player player = (Player) entity; if(!manager.isInCombat(player)) return; LivingEntity enemy = manager.getEnemy(player); if(enemy == null) return; e.setCancelled(false); this.expansion.sendNoEntryMessage(player, enemy); }
Example 7
Source File: FriendlyFireRefundMatchModule.java From PGM with GNU Affero General Public License v3.0 | 5 votes |
@EventHandler(priority = EventPriority.NORMAL) public void onHit(EntityDamageByEntityEvent event) { final Entity damager = event.getDamager(); if (!event.isCancelled() || event.getCause() != EntityDamageEvent.DamageCause.PROJECTILE || !(damager instanceof Projectile) || !damager.hasMetadata(METADATA_KEY)) return; final Player shooter = (Player) ((Projectile) damager).getShooter(); if (match.getParticipant(shooter) == null) return; damager.remove(); shooter.getInventory().addItem(new ItemStack(Material.ARROW)); }
Example 8
Source File: LWCPlayerListener.java From Modern-LWC with MIT License | 5 votes |
@EventHandler public void itemFrameItemRemoval(EntityDamageByEntityEvent e) { if (e.isCancelled()) return; Entity entity = e.getEntity(); if (plugin.getLWC().isProtectable(e.getEntity().getType())) { int A = 50000 + entity.getUniqueId().hashCode(); LWC lwc = LWC.getInstance(); Protection protection = lwc.getPhysicalDatabase().loadProtection(entity.getWorld().getName(), A, A, A); if (!(entity instanceof Player)) { if (e.getDamager() instanceof Projectile) { if (protection != null) { e.setCancelled(true); } if ((((entity instanceof StorageMinecart)) || ((entity instanceof HopperMinecart))) && (protection != null)) { e.setCancelled(true); } } if (e.getDamager() instanceof Player) { Player p = (Player) e.getDamager(); if (protection != null && !lwc.canAccessProtection(p, protection)) { e.setCancelled(true); } if (p.hasPermission("lwc.lockentity." + e.getEntityType()) || p.hasPermission("lwc.lockentity.all")) { if (onPlayerEntityInteract(p, entity, e.isCancelled())) { e.setCancelled(true); } } if ((((entity instanceof StorageMinecart)) || ((entity instanceof HopperMinecart))) && (protection != null)) { e.setCancelled(true); } } } } }
Example 9
Source File: FriendlyFireRefundMatchModule.java From ProjectAres with GNU Affero General Public License v3.0 | 5 votes |
@EventHandler(priority = EventPriority.NORMAL) public void handleFriendlyFire(EntityDamageByEntityEvent event) { if(event.isCancelled() && event.getDamager() instanceof Arrow) { Arrow arrow = (Arrow) event.getDamager(); if(arrow.getPickupStatus() == Arrow.PickupStatus.ALLOWED && arrow.getShooter() != null && arrow.getShooter() instanceof Player){ Player owner = (Player) arrow.getShooter(); owner.getInventory().addItem(new ItemStack(Material.ARROW)); arrow.remove(); } } }
Example 10
Source File: ArrowTurret.java From Civs with GNU General Public License v3.0 | 5 votes |
@EventHandler public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) { if (event.isCancelled()) { return; } Entity projectile = event.getDamager(); if (!(projectile instanceof Arrow) || !(event.getEntity() instanceof Player)) { return; } Arrow arrow = (Arrow) projectile; Player damagee = (Player) event.getEntity(); double maxHP = damagee.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(); //TODO check to make sure this works if (arrowDamages.get(arrow) == null) { return; } //String ownerName = arrowOwners.get(arrow); //Player player = null; //if (ownerName != null) { // player = Bukkit.getPlayer(ownerName); //} int damage = (int) ((double) arrowDamages.get(arrow) / 100.0 * maxHP); arrowDamages.remove(arrow); //arrowOwners.remove(arrow); //if (player != null) { // damagee.damage(damage, player); //} else { // damagee.damage(damage); //damagee.damage(damage); //} // event.setCancelled(true); damage = DamageEffect.adjustForArmor(damage, damagee); event.setDamage(damage); }
Example 11
Source File: SentinelTrait.java From Sentinel with MIT License | 5 votes |
/** * Called when this sentinel attacks something, to correct damage handling. */ public void whenAttacksAreHappeningFromMe(EntityDamageByEntityEvent event) { if (event.isCancelled()) { return; } if (!npc.isSpawned()) { return; } if (SentinelPlugin.instance.alternateDamage) { if (canEnforce) { canEnforce = false; whenAttacksHappened(event); if (!event.isCancelled()) { ((LivingEntity) event.getEntity()).damage(event.getFinalDamage()); if (event.getEntity() instanceof LivingEntity) { weaponHelper.knockback((LivingEntity) event.getEntity()); } } if (SentinelPlugin.debugMe) { debug("enforce damage value to " + event.getFinalDamage()); } } else { if (SentinelPlugin.debugMe) { debug("refuse damage enforcement"); } } event.setDamage(0); event.setCancelled(true); return; } event.setDamage(EntityDamageEvent.DamageModifier.BASE, getDamage(false)); }
Example 12
Source File: Projectiles.java From CardinalPGM with MIT License | 5 votes |
@EventHandler public void onEntityHitByProjectile(EntityDamageByEntityEvent event) { if (event.isCancelled()) return; if (event.getCause().equals(DamageCause.PROJECTILE)) { ProjectileSource source = ((Projectile) event.getDamager()).getShooter(); if (source instanceof Player) { ((Player) source).playSound(((Player) source).getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 0.2F, 0.5F); } if (event.getDamager().getType().equals(projectile) && event.getDamager().hasMetadata("custom")) { Entity arrow = event.getEntity().getWorld().spawnEntity(event.getDamager().getLocation(), EntityType.ARROW); ((Projectile) arrow).setShooter(source); arrow.setVelocity(event.getDamager().getVelocity()); event.getDamager().remove(); if (event.getEntity() instanceof LivingEntity) { for (PotionEffect effect : potionEffects) { ((LivingEntity) event.getEntity()).addPotionEffect(effect); } final Entity entity = event.getEntity(); Bukkit.getServer().getScheduler().runTaskLater(GameHandler.getGameHandler().getPlugin(), new Runnable() { @Override public void run() { ((LivingEntity) entity).setArrowsStuck(((LivingEntity) entity).getArrowsStuck() - 1); } }, 0); } } } }
Example 13
Source File: SeismicAxe.java From Slimefun4 with GNU General Public License v3.0 | 5 votes |
private void pushEntity(Player p, Entity entity) { Vector vector = entity.getLocation().toVector().subtract(p.getLocation().toVector()).normalize(); vector.multiply(STRENGTH); vector.setY(0.9); entity.setVelocity(vector); if (entity.getType() != EntityType.PLAYER || p.getWorld().getPVP()) { EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(p, entity, DamageCause.ENTITY_ATTACK, 6D); Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) { ((LivingEntity) entity).damage(DAMAGE); } } }
Example 14
Source File: MagnetShoeListener.java From BedwarsRel with GNU General Public License v3.0 | 5 votes |
@EventHandler(priority = EventPriority.HIGHEST) public void onDamage(EntityDamageByEntityEvent ev) { if (ev.isCancelled()) { return; } if (!(ev.getEntity() instanceof Player)) { return; } Game game = BedwarsRel.getInstance().getGameManager().getGameOfPlayer((Player) ev.getEntity()); if (game == null) { return; } if (game.getState() != GameState.RUNNING) { return; } Player player = (Player) ev.getEntity(); ItemStack boots = player.getInventory().getBoots(); if (boots == null) { return; } MagnetShoe shoe = new MagnetShoe(); if (boots.getType() != shoe.getItemMaterial()) { return; } if (this.rollKnockbackDice()) { ev.setCancelled(true); player.damage(ev.getDamage()); } }
Example 15
Source File: LWCEntityListener.java From Modern-LWC with MIT License | 4 votes |
@EventHandler(ignoreCancelled = true) public void onEntityDamageByEntity(EntityDamageByEntityEvent event) { if (!LWC.ENABLED || event.isCancelled()) { return; } LWC lwc = plugin.getLWC(); if (event.getDamager() instanceof Player) { Player player = (Player) event.getDamager(); Entity entity = event.getEntity(); EntityBlock entityBlock = new EntityBlock(entity); boolean ignoreBlockDestruction = Boolean .parseBoolean(lwc.resolveProtectionConfiguration(entityBlock, "ignoreBlockDestruction")); if (ignoreBlockDestruction) { return; } if (event.getEntityType().equals(EntityType.ARMOR_STAND)) { if (event.getDamage() < 1.0 || ((Player) event.getDamager()).getGameMode().equals(GameMode.CREATIVE)) { // Armor Stand Broke ProtectionCache cache = lwc.getProtectionCache(); String cacheKey = cache.cacheKey(entityBlock.getLocation()); // In the event they place a block, remove any known nulls there if (cache.isKnownNull(cacheKey)) { cache.remove(cacheKey); } Protection protection = lwc.findProtection(entityBlock); if (protection == null) { return; } boolean canAccess = lwc.canAccessProtection(player, protection); boolean canAdmin = lwc.canAdminProtection(player, protection); try { // Removing protection LWCProtectionDestroyEvent evt = new LWCProtectionDestroyEvent(player, protection, LWCProtectionDestroyEvent.Method.ENTITY_DESTRUCTION, canAccess, canAdmin); lwc.getModuleLoader().dispatchEvent(evt); protection.remove(); protection.removeAllPermissions(); protection.removeCache(); if (evt.isCancelled() || !canAccess) { event.setCancelled(true); } } catch (Exception e) { event.setCancelled(true); lwc.sendLocale(player, "protection.internalerror", "id", "BLOCK_BREAK"); e.printStackTrace(); } } /*else { // Armor Stand Punched LWC.getInstance().log("Armor Stand Punched"); if(plugin.getLWC().isProtectable(entity.getType())){ int A = 50000 + entity.getUniqueId().hashCode(); Protection protection = lwc.getPhysicalDatabase().loadProtection(entity.getWorld().getName(), A, A, A); boolean canAccess = lwc.canAccessProtection(player, protection); boolean canAdmin = lwc.canAdminProtection(player, protection); Set<String> actions = lwc.wrapPlayer(player).getActionNames(); Module.Result result = Module.Result.CANCEL; // TODO: Finish this implementation if (protection != null) { LWCEntityDamageByEntityEvent evt = new LWCEntityDamageByEntityEvent(event, protection, actions, canAccess, canAdmin); lwc.getModuleLoader().dispatchEvent(evt); result = evt.getResult(); } else { } if (result == Module.Result.ALLOW) { return; } if (player.hasPermission("lwc.lockentity." + entity.getType()) || player.hasPermission("lwc.lockentity.all")) { if (onPlayerEntityInteract(p, entity, e.isCancelled())) { chunkUnload(entity.getWorld().getName(), A); e.setCancelled(true); } } if (protection != null) { if (canAccess) return; e.setCancelled(true); } } }*/ } } }
Example 16
Source File: EventValidator.java From EliteMobs with GNU General Public License v3.0 | 4 votes |
public static EliteMobEntity getEventEliteMob(ElitePower mobPower, EntityDamageByEntityEvent event) { if (event.isCancelled()) return null; Player player = EntityFinder.findPlayer(event); if (player == null) return null; LivingEntity livingEntity = EntityFinder.getRealDamager(event); if (livingEntity == null) return null; EliteMobEntity eliteMobEntity = EntityTracker.getEliteMobEntity(livingEntity); if (eliteMobEntity == null) return null; if (!EntityTracker.hasPower(mobPower, eliteMobEntity)) return null; return eliteMobEntity; }
Example 17
Source File: CombatSystem.java From EliteMobs with GNU General Public License v3.0 | 4 votes |
@EventHandler(priority = EventPriority.HIGHEST) public void eliteMobDamageByPlayer(EntityDamageByEntityEvent event) { if (event.isCancelled()) return; LivingEntity damager = EntityFinder.getRealDamager(event); if (damager == null) return; EliteMobEntity eliteMobEntity = EntityTracker.getEliteMobEntity(event.getEntity()); if (eliteMobEntity == null) return; //From this point on, the event damage is handled by Elite Mobs /* Case in which the player is not the entity dealing damage, just deal raw damage */ if (!damager.getType().equals(EntityType.PLAYER) && EntityTracker.isEliteMob(damager)) { event.setDamage(event.getDamage()); return; } for (EntityDamageEvent.DamageModifier modifier : EntityDamageEvent.DamageModifier.values()) if (event.isApplicable(modifier)) event.setDamage(modifier, 0); /* Case in which a player has hit the Elite Mob */ if (!damager.getType().equals(EntityType.PLAYER)) return; Player player = (Player) damager; double playerTier; if (player.getInventory().getItemInMainHand() == null || player.getInventory().getItemInMainHand().getType().equals(Material.BOW) && event.getDamager() instanceof Player) playerTier = 0; else playerTier = ItemTierFinder.findBattleTier(player.getInventory().getItemInMainHand()); double eliteTier = MobTierFinder.findMobTier(eliteMobEntity); double maxHealth = eliteMobEntity.getMaxHealth(); double newDamage = playerToEliteDamageFormula(eliteTier, playerTier, maxHealth, player, eliteMobEntity.getLivingEntity()); if (event.getDamager() instanceof Arrow){ double arrowSpeedMultiplier = Math.sqrt(Math.pow(event.getDamager().getVelocity().getX(), 2) + Math.pow(event.getDamager().getVelocity().getY(), 2) + Math.pow(event.getDamager().getVelocity().getZ(), 2)) / 5; arrowSpeedMultiplier = (arrowSpeedMultiplier < 1) ? arrowSpeedMultiplier : 1; newDamage *= arrowSpeedMultiplier; } event.setDamage(EntityDamageEvent.DamageModifier.BASE, newDamage); }
Example 18
Source File: SentinelTrait.java From Sentinel with MIT License | 4 votes |
/** * Called when this sentinel attacks something with a projectile, to correct damage handling. */ public void whenAttacksAreHappeningFromMyArrow(EntityDamageByEntityEvent event) { if (event.isCancelled()) { return; } if (!npc.isSpawned()) { return; } if (SentinelPlugin.instance.alternateDamage) { if (canEnforce) { canEnforce = false; whenAttacksHappened(event); if (!event.isCancelled()) { ((LivingEntity) event.getEntity()).damage(getDamage(true)); if (event.getEntity() instanceof LivingEntity) { weaponHelper.knockback((LivingEntity) event.getEntity()); } } if (SentinelPlugin.debugMe) { debug("enforce damage value to " + getDamage(true)); } } else { if (SentinelPlugin.debugMe) { debug("refuse damage enforcement"); } } event.setDamage(0); event.setCancelled(true); return; } double dam = getDamage(true); double modder = event.getDamage(EntityDamageEvent.DamageModifier.BASE); double rel = modder == 0.0 ? 1.0 : dam / modder; event.setDamage(EntityDamageEvent.DamageModifier.BASE, dam); for (EntityDamageEvent.DamageModifier mod : EntityDamageEvent.DamageModifier.values()) { if (mod != EntityDamageEvent.DamageModifier.BASE && event.isApplicable(mod)) { event.setDamage(mod, event.getDamage(mod) * rel); if (SentinelPlugin.debugMe) { debug("Set damage for " + mod + " to " + event.getDamage(mod)); } } } }
Example 19
Source File: SkeletonPillar.java From EliteMobs with GNU General Public License v3.0 | 2 votes |
@EventHandler public void onHit(EntityDamageByEntityEvent event) { if (event.isCancelled()) return; if (!event.getEntity().getType().equals(EntityType.SKELETON)) return; /* Run random check to see if the power should activate */ if (ThreadLocalRandom.current().nextDouble() > 0.20) return; EliteMobEntity eliteMobEntity = EntityTracker.getEliteMobEntity(event.getEntity()); if (eliteMobEntity == null) return; if (!eliteMobEntity.hasPower(this)) return; if (isInCooldown(eliteMobEntity)) return; eliteMobEntity.getLivingEntity().setAI(false); PowerCooldown.startCooldownTimer(eliteMobEntity, cooldowns, 20 * 27); Location location1 = eliteMobEntity.getLivingEntity().getLocation().clone() .add(locationMover(eliteMobEntity.getLivingEntity().getLocation().clone(), 20, 7)); Location location2 = eliteMobEntity.getLivingEntity().getLocation().clone() .add(locationMover(eliteMobEntity.getLivingEntity().getLocation().clone(), 20, -7)); new BukkitRunnable() { int timer = 1; @Override public void run() { if (timer > 20 * 7 || !eliteMobEntity.getLivingEntity().isValid()) { eliteMobEntity.getLivingEntity().setAI(true); cancel(); } else if (timer > 20 * 1 && timer < 20 * 7) { pillarEffect(eliteMobEntity.getLivingEntity().getLocation().clone(), timer, 7); pillarEffect(eliteMobEntity.getLivingEntity().getLocation().clone(), timer, -7); } else { pillarWarningEffect(location1); pillarWarningEffect(location2); } timer++; } }.runTaskTimer(MetadataHandler.PLUGIN, 0, 1); }
Example 20
Source File: CombatSystem.java From EliteMobs with GNU General Public License v3.0 | 2 votes |
@EventHandler(priority = EventPriority.HIGHEST) public void eliteMobDamageHandler(EntityDamageByEntityEvent event) { if (event.isCancelled()) return; if (!(event.getEntity() instanceof Player)) return; LivingEntity damager = EntityFinder.getRealDamager(event); if (damager == null) return; if (!EntityTracker.isEliteMob(event.getDamager())) return; EliteMobEntity eliteMobEntity = EntityTracker.getEliteMobEntity(damager); if (eliteMobEntity == null) return; //From this point on, the damage event is fully altered by Elite Mobs //Get rid of all vanilla armor reduction for (EntityDamageEvent.DamageModifier modifier : EntityDamageEvent.DamageModifier.values()) if (event.isApplicable(modifier)) event.setDamage(modifier, 0); Player player = (Player) event.getEntity(); //Determine tiers double eliteTier = MobTierFinder.findMobTier(eliteMobEntity); double playerTier = ItemTierFinder.findArmorSetTier(player); double newDamage = eliteToPlayerDamageFormula(eliteTier, playerTier, player, event); //Prevent untouchable armor and 1-shots if (newDamage < 1) newDamage = 1; if (newDamage > 19) newDamage = 19; //Set the final damage value event.setDamage(EntityDamageEvent.DamageModifier.BASE, newDamage); //Deal with the player getting killed if (player.getHealth() - event.getDamage() <= 0) PlayerDeathMessageByEliteMob.addDeadPlayer(player, PlayerDeathMessageByEliteMob.intializeDeathMessage(player, damager)); }