SchematicUtil.java 文件源码

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

项目:PlotMe-Core 作者:
@SuppressWarnings("deprecation")
private void setTag(ItemStack is, ItemTag itemtag) {
    List<Ench> enchants = itemtag.getEnchants();
    //Integer repaircost = itemtag.getRepairCost();
    List<String> pages = itemtag.getPages();
    String author = itemtag.getAuthor();
    String title = itemtag.getTitle();
    Display display = itemtag.getDisplay();

    ItemMeta itemmeta = is.getItemMeta();

    if (display != null) {
        List<String> lores = display.getLore();
        String name = display.getName();

        itemmeta.setLore(lores);
        itemmeta.setDisplayName(name);
    }

    if (itemmeta instanceof BookMeta) {
        BookMeta bookmeta = (BookMeta) itemmeta;
        bookmeta.setAuthor(author);
        bookmeta.setTitle(title);
        bookmeta.setPages(pages);
    }

    if (itemmeta instanceof EnchantmentStorageMeta) {
        EnchantmentStorageMeta enchantmentstoragemeta = (EnchantmentStorageMeta) itemmeta;

        for (Ench enchant : enchants) {
            enchantmentstoragemeta.addEnchant(Enchantment.getById(enchant.getId()), enchant.getLvl(), true);
        }
    }

    is.setItemMeta(itemmeta);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号