package com.mingliqiye.minecraft.enchantment.conflict.enchantment;

import com.mingliqiye.minecraft.enchantment.conflict.config.ModConfig;

import java.util.Arrays;
import java.util.List;

public class PiercingEnchantment extends Enchantment {
    private final String id;

    private PiercingEnchantment(String id) {
        this.id = id;
    }

    private static final List<String> enchantmentIds =
        Arrays.asList("minecraft:piercing","minecraft:multishot");

    public static PiercingEnchantment ofId(String id) {
        if (enchantmentIds.contains(id)) {
            return new PiercingEnchantment(id);
        }
        return null;
    }

    @Override
    public Boolean canBeCombined(Enchantment enchantment) {
        if (enchantment instanceof PiercingEnchantment) {
            return ModConfig.getInstance().isAllowPiercingEnchantment();
        }
        return super.canBeCombined(enchantment);
    }

    @Override
    public String getId() {
        return id;
    }
}
