Fixed some Corrupted Fangs bugs

- Fixed the ability always doing 6 extra damage
- Fixed the ability damaging players when ability-player-damage config
setting is false
This commit is contained in:
HexedHero 2021-04-05 23:51:23 +01:00
parent ed32317419
commit 241e172eea

View File

@ -82,9 +82,14 @@ public class Corrupted_Fangs extends Ability implements Listener {
@EventHandler
public void a(EntityDamageByEntityEvent event) {
if (event.getDamager() instanceof EvokerFangs && entities.contains(event.getDamager().getEntityId())
&& MMOUtils.canDamage(stats.getPlayer(), event.getEntity()))
new AttackResult(damage, DamageType.SKILL, DamageType.MAGIC).damage(stats.getPlayer(), (LivingEntity) event.getEntity());
if (event.getDamager() instanceof EvokerFangs && entities.contains(event.getDamager().getEntityId())) {
event.setDamage(0); // Fangs do 6 damage in vanilla so lets set to 0 to not do extra damage
if (MMOUtils.canDamage(stats.getPlayer(), event.getEntity())) {
new AttackResult(damage, DamageType.SKILL, DamageType.MAGIC).damage(stats.getPlayer(), (LivingEntity) event.getEntity());
} else {
event.setCancelled(true); // Cancel the event if we cannot damage the target such as a player
}
}
}
}
}