Signed book looses styling
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 12.7k
- Forks
- 3.5k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 11
Description
Expected behavior
Components obtained through pages() should be styled the same for WRITABLE_BOOK and WRITTEN_BOOK.
Observed/Actual behavior
WRITABLE_BOOK:
[01:57:49 INFO]: [TestPlugin] isSigning: false, hasStyling: true
[01:57:49 INFO]: [TestPlugin] <gold>test
WRITTEN_BOOK:
[01:57:59 INFO]: [TestPlugin] isSigning: true, hasStyling: false
[01:57:59 INFO]: [TestPlugin] §6test
Steps/models to reproduce
public final class Plugin extends JavaPlugin implements Listener {
private final Logger logger = getLogger();
private final MiniMessage miniMessage = MiniMessage.miniMessage();
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onPlayerEditBook(PlayerEditBookEvent e) {
Component page = e.getNewBookMeta().pages().getFirst();
logger.info(String.format("isSigning: %s, hasStyling: %s", e.isSigning(), page.hasStyling()));
logger.info(miniMessage.serialize(page));
}
}
- Give yourself a writable book:
/give @p minecraft:writable_book - Open the book and write formatted text, i.e.
§6test, click done - Open the book again, this time sign the book. It doesn't matter if you change the content of the book.
- Check logs in console
Plugin and Datapack List
plugins
[02:04:43 INFO]: Server Plugins (1):
[02:04:43 INFO]: Bukkit Plugins:
[02:04:43 INFO]: - TestPlugin
datapack list
[02:04:47 INFO]: There are 3 data pack(s) enabled: [vanilla (built-in)], [file/bukkit (world)], [paper (built-in)]
[02:04:47 INFO]: There are no more data packs available
Paper version
Paper version 1.20.6-147-ver/1.20.6@e41d44f (2024-06-17T19:24:35Z) (Implementing API version 1.20.6-R0.1-SNAPSHOT)
Other
This also happens with other serializers, MiniMessage was used as an example.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the behavior in PlayerEditBookEvent using Book.pages() for writable and written books on the reported Paper version. Trace how each book type supplies its page Components; done means pages() returns equivalent styling for both types, with a regression test covering the signing flow.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100