Skip to content

BookMeta#asBook yields not full book #14135

Description

@TheosRee

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions