Fix alchemy only POTION

This commit is contained in:
kireevm96 2021-10-06 13:08:09 +03:00
parent 68706e70f6
commit 24185df102

View File

@ -8,6 +8,7 @@ import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityPotionEffectEvent;
import org.bukkit.event.entity.EntityPotionEffectEvent.Cause;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.potion.PotionEffect;
import org.jetbrains.annotations.NotNull;
@ -38,6 +39,9 @@ public class Alchemy extends EcoEnchant {
if (!(event.getEntity() instanceof LivingEntity entity)) {
return;
}
if (!(event.getCause() == Cause.POTION_DRINK) && !(event.getCause() == Cause.POTION_SPLASH) ) {
return;
}
if (entity.hasMetadata(event.getNewEffect().toString())) {
return;