ExcellentEnchants-spigot/Core/src/main/java/su/nightexpress/excellentenchants/enchantment/registry/wrapper/DataGather.java

32 lines
1.2 KiB
Java

package su.nightexpress.excellentenchants.enchantment.registry.wrapper;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.Event;
import org.bukkit.event.EventPriority;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import su.nightexpress.excellentenchants.api.enchantment.IEnchantment;
import su.nightexpress.excellentenchants.enchantment.util.EnchantUtils;
import java.util.Map;
public abstract class DataGather<E extends Event, T extends IEnchantment> {
@Nullable
public abstract LivingEntity getEntity(@NotNull E event);
@NotNull
public abstract EquipmentSlot[] getEnchantSlots(@NotNull E event);
public abstract boolean checkPriority(@NotNull T enchant, @NotNull EventPriority priority);
@NotNull
public Map<ItemStack, Map<T, Integer>> getEnchants(@NotNull E event, @NotNull Class<T> enchantClass, @NotNull LivingEntity entity) {
return EnchantUtils.getEquipped(entity, enchantClass, this.getEnchantSlots(event));
}
public abstract boolean useEnchant(@NotNull E event, @NotNull LivingEntity entity, @NotNull ItemStack item, @NotNull T enchant, int level);
}