protected void a() { switch (type) { case MELEE: setEquipment( 0, CraftItemStack.asNMSCopy( new org.bukkit.inventory.ItemStack( Material.getMaterial(ConfigEntries.GUARD_MELEE_ITEM.<String>getValue())))); break; case RANGED: setEquipment(0, new ItemStack(Items.BOW)); break; } setEquipment( 1, CraftItemStack.asNMSCopy( new org.bukkit.inventory.ItemStack( Material.getMaterial(ConfigEntries.GUARD_BOOTS_ITEM.<String>getValue())))); setEquipment( 2, CraftItemStack.asNMSCopy( new org.bukkit.inventory.ItemStack( Material.getMaterial(ConfigEntries.GUARD_LEGGINGS_ITEM.<String>getValue())))); setEquipment( 3, CraftItemStack.asNMSCopy( new org.bukkit.inventory.ItemStack( Material.getMaterial(ConfigEntries.GUARD_CHESTPLATE_ITEM.<String>getValue())))); setEquipment( 4, CraftItemStack.asNMSCopy( new org.bukkit.inventory.ItemStack( Material.getMaterial(ConfigEntries.GUARD_HELMET_ITEM.<String>getValue())))); }
@Override public ItemStack setBook(Tag item) { ItemStack chestItem = new ItemStack(Material.WRITTEN_BOOK); // Bukkit.getLogger().info("item data"); // Bukkit.getLogger().info(item.toString()); Map<String, Tag> contents = (Map<String, Tag>) ((CompoundTag) item).getValue().get("tag").getValue(); // BookMeta bookMeta = (BookMeta) chestItem.getItemMeta(); String author = ((StringTag) contents.get("author")).getValue(); // Bukkit.getLogger().info("Author: " + author); // bookMeta.setAuthor(author); String title = ((StringTag) contents.get("title")).getValue(); // Bukkit.getLogger().info("Title: " + title); // bookMeta.setTitle(title); Map<String, Tag> display = (Map<String, Tag>) (contents.get("display")).getValue(); List<Tag> loreTag = ((ListTag) display.get("Lore")).getValue(); List<String> lore = new ArrayList<String>(); for (Tag s : loreTag) { lore.add(((StringTag) s).getValue()); } // Bukkit.getLogger().info("Lore: " + lore); net.minecraft.server.v1_7_R4.ItemStack stack = CraftItemStack.asNMSCopy(chestItem); // Pages NBTTagCompound tag = new NBTTagCompound(); // Create the NMS Stack's NBT (item data) tag.setString("title", title); // Set the book's title tag.setString("author", author); NBTTagList pages = new NBTTagList(); List<Tag> pagesTag = ((ListTag) contents.get("pages")).getValue(); for (Tag s : pagesTag) { pages.add(new NBTTagString(((StringTag) s).getValue())); } tag.set("pages", pages); // Add the pages to the tag stack.setTag(tag); // Apply the tag to the item chestItem = CraftItemStack.asCraftMirror(stack); ItemMeta bookMeta = (ItemMeta) chestItem.getItemMeta(); bookMeta.setLore(lore); chestItem.setItemMeta(bookMeta); return chestItem; }