package com.yaohun.demonskills.util;

import me.Demon.DemonPlugin.DemonAPI;
import me.Demon.DemonPlugin.data.NbtItem;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

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

public class StackUtil {

    public static ItemStack getSkillSlot(int pLevel,int needLevel) {
        ItemStack item = DemonAPI.getAirItems().clone();
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName("§8« §6点击放入灵技石 §8»");
        if (pLevel < needLevel) {
            List<String> lore = new ArrayList<>();
            lore.add("§c§l★ §7等级需求: §cLv." + needLevel);
            item.setAmount(3);
            meta.setLore(lore);
        } else {
            item.setAmount(2);
        }
        item.setItemMeta(meta);
        NbtItem nbtItem = new NbtItem(item);
        nbtItem.setInteger("NeedLevel",needLevel);
        return nbtItem.getItem();
    }

    public static ItemStack tagSkillStack(int rawSlot){
        ItemStack stack = DemonAPI.getAirItems().clone();
        NbtItem nbtItem = new NbtItem(stack);
        nbtItem.setInteger("RawSlot",rawSlot);
        return nbtItem.getItem();
    }
}
