ItemBuilder.java 文件源码

java
阅读 30 收藏 0 点赞 0 评论 0

项目:AlphaLibary 作者:
/**
 * Get the final {@link ItemStack} with all the attributes you have been adding
 *
 * @return the {@link ItemStack} out of this {@link ItemBuilder}
 */
public ItemStack build() {
    ItemStack s = new ItemStack(material);
    s.setAmount(amount);
    s.setDurability(damage);
    ItemMeta m = s.getItemMeta();

    for (ItemFlag iflag : itemflags)
        m.addItemFlags(iflag);
    m.setDisplayName(name);
    m.setLore(lore);
    s.setItemMeta(m);
    for (Map.Entry<Enchantment, Integer> temp : enchantments.entrySet())
        s.addUnsafeEnchantment(temp.getKey(), temp.getValue());

    for (ItemData id : getAllData())
        try {
            id.applyOn(s);
        } catch (WrongDataException e) {
            e.printStackTrace();
        }

    return s;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号