I'm trying to create a custom book without the "Original" or "Copy of Original" line of text right underneath the author. On the BookMeta API it specifies that if I run setGeneration(null); on the BookMeta, it should remove it, but this isn't working for me. Code: Code (Text): package lucien.HardcoreGames.kits; import java.util.ArrayList; import java.util.List; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.BookMeta; import com.connorlinfoot.actionbarapi.ActionBarAPI; import lucien.HardcoreGames.game.ChosenKits; import lucien.HardcoreGames.game.Tracking; public class Analyzer { public static void createInfoBook(Player analyzer, List<Player> playerList) { //Creates the book item ItemStack analyzedBook = new ItemStack(Material.WRITTEN_BOOK, 1); //Saves information that the book contains BookMeta bookInfo = (BookMeta)analyzedBook.getItemMeta(); //Sets the author bookInfo.setAuthor(ChatColor.YELLOW + "Lucien"); //Sets the title bookInfo.setTitle(ChatColor.BOLD + "" + ChatColor.DARK_PURPLE + "Pre-Game Analysis"); //Creates a new list to store the book lore List<String> lore = new ArrayList<String>(); //Adds lore to the lore list lore.add(ChatColor.translateAlternateColorCodes('&', "&8&l-&7Shows the kit chosen by each opponent.")); //Sets the lore of the book to the lore list bookInfo.setLore(lore); //Creates a new list to store the pages of the book List<String> pages = new ArrayList<String>(); for(Player player : playerList) { pages.add(ChatColor.translateAlternateColorCodes('&', player.getName() + ": " + ChosenKits.playerKits.get(player.getName()))); } bookInfo.setPages(pages); bookInfo.setGeneration((BookMeta.Generation)null); analyzedBook.setItemMeta(bookInfo); analyzer.getInventory().addItem(analyzedBook); } } I'm on version 1.14.4, any help is appreciated. Thanks in advance
bookInfo.setGeneration(null); https://papermc.io/javadocs/paper/1...rg.bukkit.inventory.meta.BookMeta.Generation- ^ it says Code (Text): @Nullable /edit whupps i didnt read properly D: I just checked the NBT data for written books https://minecraft.gamepedia.com/Written_Book and according to that its definitly possible not to have the tag present. How about you create a new book (and hope it doesnt have the generation-tag in it) and give that to the player instead?
Use Material.WRITABLE_BOOK not sure if it will fix your issue but i recently had a problem with BookMeta on 1.15.1 and it was caused by using Material.WRITTRN_BOOK