LoreBooks

Factory for creating in-game written books from lore entries.

This object handles the formatting and pagination of lore content into Minecraft's written book format, respecting line length and page limits.

Book Types

  • News Book: Weekly gazette with recent headlines

  • History Book: Player-facing narrative compilation of realm lore

  • Archive Book: Raw archive records for admin review

See also

for the source of lore entries

Types

Link copied to clipboard
data class BookSubmission(val title: String, val author: String, val content: String)

Represents extracted content from a player-written book.

Properties

Link copied to clipboard

Title used for the admin-facing raw archive ledger.

Link copied to clipboard

Title used for the player-facing compiled history book.

Link copied to clipboard
const val MAX_BOOK_TITLE_LENGTH: Int = 32

Maximum title length for written books (Minecraft serialization limit).

Link copied to clipboard
const val MAX_LINE_LENGTH: Int = 19

Maximum characters per line before wrapping (vanilla-safe for written book rendering).

Link copied to clipboard
const val MAX_LINES_PER_PAGE: Int = 14

Maximum lines per book page (vanilla-safe for written book rendering).

Link copied to clipboard
const val MAX_PAGES: Int = 100

Maximum pages in a book (Minecraft limit).

Link copied to clipboard
const val NEWS_ENTRY_LIMIT: Int = 25

Maximum entries included in a news book.

Link copied to clipboard

Prefix for weekly gazette book titles.

Link copied to clipboard

Prefix used for Lorekeeper-issued player biography titles.

Functions

Link copied to clipboard
fun createBiographyBook(playerName: String, alignment: String, tier: String, score: Int, summary: String): ItemStack

Creates a Lorekeeper player biography book for a player.

Link copied to clipboard
fun createHistoryBook(entries: List<LoreStorage.LoreEntry>, summary: String? = null, edition: Int = 0): ItemStack

Creates a player-facing realm history book from all lore entries.

Link copied to clipboard
fun createNewsBook(entries: List<LoreStorage.LoreEntry>, weekNumber: Long, summary: String? = null): ItemStack

Creates a weekly news book (Lorekeeper Gazette) from lore entries.

Link copied to clipboard

Creates a raw archive ledger book for admin review.

Link copied to clipboard
fun createSubmittedBookCopies(title: String, author: String, content: String, submittedBy: String, submittedById: String, salePrice: Int, submittedTimestamp: Long = 0): List<ItemStack>

Creates one or more Lorekeeper-issued volumes for a submitted player book.

Link copied to clipboard
fun createSubmittedBookCopy(title: String, author: String, content: String, submittedBy: String, submittedById: String, salePrice: Int, submittedTimestamp: Long = 0): ItemStack

Creates a Lorekeeper-issued archived copy of a player-submitted book.

Link copied to clipboard

Extracts content from a player-written book.

Link copied to clipboard
fun extractWrittenBookAuthor(stack: ItemStack): String?

Extracts only the author from a written book.

Link copied to clipboard
fun extractWrittenBookContent(stack: ItemStack): String?

Extracts only the content from a written book.

Link copied to clipboard
fun extractWrittenBookTitle(stack: ItemStack): String?

Extracts only the title from a written book.

Link copied to clipboard

Formats a single lore entry for display in a book.

Link copied to clipboard
fun formatNewsHeader(weekNumber: Long): String

Formats the header line for a news gazette.

Link copied to clipboard
fun getSubmittedBookPrice(stack: ItemStack): Int

Returns the sale price stored on a submitted book copy.

Link copied to clipboard
fun getSubmittedBookSellerId(stack: ItemStack): String?

Returns the submitting player's UUID string stored on a submitted book copy.

Link copied to clipboard
fun getSubmittedBookSellerName(stack: ItemStack): String?

Returns the submitting player's display name stored on a submitted book copy.

Link copied to clipboard
fun getSubmittedBookTimestamp(stack: ItemStack): Long

Returns the submission timestamp stored on a submitted book copy, or 0 when absent.

Link copied to clipboard
fun getSubmittedBookVolumeCount(stack: ItemStack): Int

Returns the total number of volumes for a submitted book copy.

Link copied to clipboard
fun getSubmittedBookVolumeNumber(stack: ItemStack): Int

Returns the 1-based volume number for a submitted book copy.

Link copied to clipboard
fun isLorekeeperBook(stack: ItemStack): Boolean

Checks if an ItemStack is a book issued by the Lorekeeper.

Link copied to clipboard
fun isSubmittedBookCopy(stack: ItemStack): Boolean

Returns true when the stack is a Lorekeeper issued copy of a submitted player book.