Made boss hunter work with ecobosses

This commit is contained in:
Auxilor 2021-03-13 22:07:43 +00:00
parent 04464ca982
commit 6d4ae7bac8

View File

@ -3,26 +3,30 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Boss;
import org.bukkit.entity.ElderGuardian;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.persistence.PersistentDataType;
import org.jetbrains.annotations.NotNull;
@SuppressWarnings("deprecation")
public class BossHunter extends EcoEnchant {
public BossHunter() {
super(
"boss_hunter", EnchantmentType.NORMAL
);
}
@Override
public void onArrowDamage(@NotNull final LivingEntity attacker,
@NotNull final LivingEntity victim,
@NotNull final Arrow arrow,
final int level,
@NotNull final EntityDamageByEntityEvent event) {
if (!(victim instanceof Boss || victim instanceof ElderGuardian)) {
if (!(victim instanceof Boss || victim instanceof ElderGuardian) && !victim.getPersistentDataContainer().has(new NamespacedKey("ecobosses", "boss"), PersistentDataType.STRING)) {
return;
}