[SPIGOT-6911] Change max book length in CraftMetaBook Created: 25/Jan/22 Updated: 31/Jan/24 Resolved: 31/Jan/24 |
|
| Status: | Resolved |
| Project: | Spigot |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Thor Bilsby | Assignee: | Unassigned |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | 1.18.1, API, spigot | ||
| Version: | 1.18.1-R0.1-SNAPSHOT |
| Guidelines Read: | Yes |
| Description |
|
When creating a written book, there is a limit to how many characters there can be used on each page. This is set in CraftMetaBook: static final int MAX_PAGE_LENGTH = 320; // 256 limit + 64 characters to allow for psuedo colour codes It is possible to create a written book with more than 320 characters. Therefore I think this should be removed. The issue can be reproduced like this: ItemStack item = new ItemStack(Material.WRITTEN_BOOK); BookMeta meta = (BookMeta) item.getItemMeta(); meta.setTitle("Title"); meta.setAuthor("Author"); String[] pages = new String[] { ".............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................." }; meta.setPages(pages); item.setItemMeta(meta); p.openBook(item); Note: There are 798 dots in the example. This will create a book and open it for the player, but the book will only be half-filled with dots. If you copy the text and paste it into a book and quill, it will fill the whole book with dots, without any problems - signing it will work as well. |
| Comments |
| Comment by Marvin Rieple [ 26/Jan/24 ] |
|
Made a PR for this: craftbukkit#1349 You can test it with BuildTools: java -jar BuildTools.jar --rev 4026 --compile spigot --pr craftbukkit:1349 |