Solved How to make custom text in book?

Discussion in 'Plugin Development' started by Archangel526, Mar 25, 2021.

Thread Status:
Not open for further replies.
  1. Offline

    Archangel526

    I tried to put my text in book, but i got *Invalid book tag*. My code:

    public static ItemStack book = new ItemStack(Material.WRITTEN_BOOK);

    @Overridepublic boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if(sender instanceof Player) {
    Player p = (Player) sender;
    BookMeta tag = (BookMeta) book.getItemMeta();List<String> lore = new ArrayList<>();
    lore.add("Test 1");
    lore.add("Test 2");
    lore.add("Test 3");
    tag.setPages(lore);
    book.setItemMeta(tag);p.openBook(book);
    return true;}
    else return false;
    }
     
  2. Offline

    CraftCreeper6

    Archangel526 likes this.
  3. Offline

    Archangel526

    Thanks, maybe you can answer my second question? How to split into lines text in book?
     
  4. Offline

    CraftCreeper6

  5. Offline

    KarimAKL

    I think they mean a new line.

    @Archangel526, you might be able to use the line feed ( \n ) character.
     
Thread Status:
Not open for further replies.

Share This Page