// Path: src/main/java/edu/self/startux/craftBay/item/ItemManager.java
// public interface ItemManager {
//     /**
//      * Does this manager manage this item exclusively?
//      */
//     boolean isManaged(ItemStack itemStack);
// 
//     /**
//      * Produce the item display name.
//      */
//     Component getDisplayName(ItemStack itemStack);
// 
//     /**
//      * Detailed item info.
//      */
//     Component getItemInfo(ItemStack itemStack);
// 
//     static List<ItemManager> getList(CraftBayPlugin plugin) {
//         List<ItemManager> result = new ArrayList<>();
//         try {
//             if (Bukkit.getPluginManager().isPluginEnabled("Mytems")) {
//                 if (Bukkit.getPluginManager().getPlugin("Mytems").getClass().getName().equals("com.cavetale.mytems.MytemsPlugin")) {
//                     result.add(new MytemsItemManager());
//                     plugin.getLogger().info("Mytems plugin found!");
//                 }
//             }
//         } catch (Throwable t) {
//             t.printStackTrace();
//         }
//         return result;
//     }
// }


import edu.self.startux.craftBay.item.ItemManager;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta;
import org.bukkit.inventory.meta.Damageable;
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
import org.bukkit.inventory.meta.FireworkEffectMeta;
import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionType;
                PotionData data = potions.getBasePotionData();
                if (data != null && data.getType() != PotionType.UNCRAFTABLE) {
                    sb.append(" ");
                    sb.append(niceEnumName(data.getType().name()));
                    if (data.isExtended()) sb.append(" Ext");
                    if (data.isUpgraded()) sb.append(" II");
                }
            } catch (IllegalArgumentException iae) { }
            if (potions.hasCustomEffects()) {
                for (PotionEffect effect: potions.getCustomEffects()) {
                    sb.append(" ");
                    sb.append(niceEnumName(effect.getType().getName()));
                    int amp = effect.getAmplifier();
                    if (amp > 0) {
                        sb.append(" ").append((amp + 1));
                    }
                }
            }
            result.append(Component.text(sb.toString()));
        }
        return result.build();
    }

    @Override
    public ItemAmount getAmount() {
        return new ItemAmount(amount, stack.getMaxStackSize());
    }

    @Override
    public Component getItemInfo() {
// Path: src/main/java/edu/self/startux/craftBay/item/ItemManager.java
// public interface ItemManager {
//     /**
//      * Does this manager manage this item exclusively?
//      */
//     boolean isManaged(ItemStack itemStack);
// 
//     /**
//      * Produce the item display name.
//      */
//     Component getDisplayName(ItemStack itemStack);
// 
//     /**
//      * Detailed item info.
//      */
//     Component getItemInfo(ItemStack itemStack);
// 
//     static List<ItemManager> getList(CraftBayPlugin plugin) {
//         List<ItemManager> result = new ArrayList<>();
//         try {
//             if (Bukkit.getPluginManager().isPluginEnabled("Mytems")) {
//                 if (Bukkit.getPluginManager().getPlugin("Mytems").getClass().getName().equals("com.cavetale.mytems.MytemsPlugin")) {
//                     result.add(new MytemsItemManager());
//                     plugin.getLogger().info("Mytems plugin found!");
//                 }
//             }
//         } catch (Throwable t) {
//             t.printStackTrace();
//         }
//         return result;
//     }
// }


// Path: src/main/java/edu/self/startux/craftBay/RealItem.java
import edu.self.startux.craftBay.item.ItemManager;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta;
import org.bukkit.inventory.meta.Damageable;
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
import org.bukkit.inventory.meta.FireworkEffectMeta;
import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionType;

                PotionData data = potions.getBasePotionData();
                if (data != null && data.getType() != PotionType.UNCRAFTABLE) {
                    sb.append(" ");
                    sb.append(niceEnumName(data.getType().name()));
                    if (data.isExtended()) sb.append(" Ext");
                    if (data.isUpgraded()) sb.append(" II");
                }
            } catch (IllegalArgumentException iae) { }
            if (potions.hasCustomEffects()) {
                for (PotionEffect effect: potions.getCustomEffects()) {
                    sb.append(" ");
                    sb.append(niceEnumName(effect.getType().getName()));
                    int amp = effect.getAmplifier();
                    if (amp > 0) {
                        sb.append(" ").append((amp + 1));
                    }
                }
            }
            result.append(Component.text(sb.toString()));
        }
        return result.build();
    }

    @Override
    public ItemAmount getAmount() {
        return new ItemAmount(amount, stack.getMaxStackSize());
    }

    @Override
    public Component getItemInfo() {
        for (ItemManager itemManager : CraftBayPlugin.getInstance().getItemManagers()) {