PaperMC / PaperMC/Paper

BookMeta#asBook yields not full book

Open
#14,135 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: needs triage version: 26.2
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Expected behavior

Using the asBook method on 26.2 should provide the same result as on 1.21.8/26.1.2.

Image
Observed/Actual behavior

The given book is yielding incomplete and wrong (legacy color codes instead real colors) data.

Image
Steps/models to reproduce

1.21.8/26.1.2 code:

final Component deserialized = MiniMessage.miniMessage().deserialize("<rainbow><bold>Really");
for (final Material material : new Material[]{Material.WRITTEN_BOOK, Material.WRITABLE_BOOK}) {
    final ItemStack book = ItemStack.of(material);
    final BookMeta bookMeta = (BookMeta) book.getItemMeta();
    final Book adventure = bookMeta.title(deserialized).author(deserialized).pages(deserialized);
    sender.sendMessage(adventure.title());
    sender.sendMessage(adventure.author());
    sender.sendMessage(join(JoinConfiguration.commas(true), adventure.pages()));
    book.setItemMeta(bookMeta);
}

26.2 code: I just get the Book now in a new line as the Interface is no longer in the return method.

final Component deserialized = MiniMessage.miniMessage().deserialize("<rainbow><bold>Really");
for (final Material material : new Material[]{Material.WRITTEN_BOOK, Material.WRITABLE_BOOK}) {
    final ItemStack book = ItemStack.of(material);
    final BookMeta bookMeta = (BookMeta) book.getItemMeta();
 // final Book adventure = bookMeta.title(deserialized).author(deserialized).pages(deserialized);
    bookMeta.title(deserialized).author(deserialized).pages(deserialized);
    final Book adventure = bookMeta.asBook();
    sender.sendMessage(adventure.title());
    sender.sendMessage(adventure.author());
    sender.sendMessage(join(JoinConfiguration.commas(true), adventure.pages()));
    book.setItemMeta(bookMeta);
}
Plugin and Datapack List

Just the test plugin's code as described above.
The code is wrapped in the following command:

getServer().getCommandMap().register("ignored", new Command("bookmetatest") {
    @Override
    public boolean execute(final CommandSender sender, final String commandLabel, final String[] args) {
        if (args.length == 1) {
            // code
        }
    }
}
Paper version

[22:57:20 INFO]: Checking version, please wait...
[22:57:20 INFO]: This server is running Paper version 26.2-92-main@0a99345 (2026-08-02T20:33:44Z) (Implementing API version 26.2.build.92-stable)
You are running the latest version

and

[20:58:37 INFO]: Checking version, please wait...
[20:58:37 ERROR]: [PaperVersionFetcher] Error while parsing version

[20:58:37 INFO]: This server is running Paper version 1.21.8-60-main@29c8822 (2025-09-06T21:49:13Z) (Implementing API version 1.21.8-R0.1-SNAPSHOT)
Error obtaining version information

Other

There is already a fix in #14081 which yields the following colors, with the only difference being the as string stored title and author in a slightly different brightness.

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the 26.2 BookMeta#asBook behavior and compare it with the 1.21.8/26.1.2 behavior shown in the reproduction. Use the provided MiniMessage book example for both written and writable books; done means title, author, and pages retain complete component data and real colors, consistent with the expected output and the fix discussed in #14081.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.