/** * Creates an instance by copying from the given {@link ItemMeta}. If that item is another * {@link EnchantmentStorageMeta}, its enchantments are copied; otherwise, the new book has no * enchantments. * @param meta the {@link ItemMeta} to copy */ public GlowMetaEnchantedBook(ItemMeta meta) { super(meta); if (!(meta instanceof EnchantmentStorageMeta)) { return; } EnchantmentStorageMeta book = (EnchantmentStorageMeta) meta; if (book.hasStoredEnchants()) { storedEnchants = new HashMap<>(book instanceof GlowMetaEnchantedBook ? ((GlowMetaEnchantedBook) book).storedEnchants : book.getStoredEnchants()); } }
@Override public boolean hasStoredEnchants() { return es.hasStoredEnchants(); }
if (storageMeta.hasStoredEnchants()) { StringBuilder string = new StringBuilder(); for (Enchantment enchant: storageMeta.getStoredEnchants().keySet()) {