--- a/net/minecraft/world/item/enchantment/DamageEnchantment.java
+++ b/net/minecraft/world/item/enchantment/DamageEnchantment.java
@@ -11,6 +11,7 @@
 import net.minecraft.world.entity.LivingEntity;
 
 public class DamageEnchantment extends Enchantment {
+
     private final Optional<TagKey<EntityType<?>>> targets;
 
     public DamageEnchantment(Enchantment.EnchantmentDefinition properties, Optional<TagKey<EntityType<?>>> applicableEntities) {
@@ -20,11 +21,7 @@
 
     @Override
     public float getDamageBonus(int level, @Nullable EntityType<?> entityType) {
-        if (this.targets.isEmpty()) {
-            return 1.0F + (float)Math.max(0, level - 1) * 0.5F;
-        } else {
-            return entityType != null && entityType.is(this.targets.get()) ? (float)level * 2.5F : 0.0F;
-        }
+        return this.targets.isEmpty() ? 1.0F + (float) Math.max(0, level - 1) * 0.5F : (entityType != null && entityType.is((TagKey) this.targets.get()) ? (float) level * 2.5F : 0.0F);
     }
 
     @Override
@@ -34,13 +31,13 @@
 
     @Override
     public void doPostAttack(LivingEntity user, Entity target, int level) {
-        if (this.targets.isPresent()
-            && target instanceof LivingEntity livingEntity
-            && this.targets.get() == EntityTypeTags.SENSITIVE_TO_BANE_OF_ARTHROPODS
-            && level > 0
-            && livingEntity.getType().is(this.targets.get())) {
-            int i = 20 + user.getRandom().nextInt(10 * level);
-            livingEntity.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, i, 3));
+        if (this.targets.isPresent() && target instanceof LivingEntity entityliving1) {
+            if (this.targets.get() == EntityTypeTags.SENSITIVE_TO_BANE_OF_ARTHROPODS && level > 0 && entityliving1.getType().is((TagKey) this.targets.get())) {
+                int j = 20 + user.getRandom().nextInt(10 * level);
+
+                entityliving1.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, j, 3), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
+            }
         }
+
     }
 }
