LorekeeperPlayerData

class LorekeeperPlayerData : SavedData(source)

Persistent per-player data for Lorekeeper interactions.

Tracks player encounters with the Lorekeeper NPC, interview progress, cooldowns, and various gameplay flags. Extends Minecraft's SavedData for automatic persistence.

Tracked Data

  • First encounter status

  • Interview question rotation index

  • Asked non-AI interview question keys

  • Encounter cooldowns

  • Action flags (one-time events)

  • Settlement chunk tracking

  • Combat status (transient)

  • Luck counter (transient)

See also

for interview logic

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Factory and persistence utilities for LorekeeperPlayerData.

Link copied to clipboard
data class InvestigationLead(val reporterId: UUID, val reporterName: String, val mentionedAs: String, val reportedQuestion: String, val reportedAnswer: String, val timestamp: Long)

A queued investigation lead derived from a player mention in an interview answer.

Link copied to clipboard
data class UnresolvedInvestigationLead(val reporterId: UUID, val reporterName: String, val mentionedAs: String, val reportedQuestion: String, val reportedAnswer: String, val timestamp: Long)

An unresolved mention captured from interview text before a unique player mapping exists.

Properties

Link copied to clipboard
open var isDirty: Boolean

Functions

Link copied to clipboard
fun addPendingRoyalty(playerId: UUID, amount: Int): Int

Adds pending royalty emeralds for a player and returns the new total.

Link copied to clipboard
fun addRepScore(playerId: UUID, delta: Int): Int

Adds to the player's reputation score.

Link copied to clipboard

Claims and removes the oldest pending investigation lead for a player.

Link copied to clipboard
fun claimPendingRoyalty(playerId: UUID): Int

Claims and clears pending royalties for a player.

Link copied to clipboard

Clears remembered non-AI interview questions for the player.

Link copied to clipboard

Returns normalized non-AI interview questions that were already asked to this player.

Link copied to clipboard

Returns known normalized aliases for a player, including canonical registered name tokens.

Link copied to clipboard
fun getLuck(playerId: UUID): Int

Gets the player's current luck counter (transient, not persisted).

Link copied to clipboard

Returns queued investigation leads for a player.

Link copied to clipboard
fun getPendingRoyalty(playerId: UUID): Int

Returns pending royalty emeralds for a player.

Link copied to clipboard
fun getRepScore(playerId: UUID): Int

Returns the player's reputation score.

Link copied to clipboard
fun hasActionFlag(playerId: UUID, flag: String): Boolean

Checks if the player has a specific action flag set.

Link copied to clipboard
fun hasEncountered(playerId: UUID): Boolean

Checks if the player has previously encountered the Lorekeeper NPC.

Link copied to clipboard
fun incrementLuck(playerId: UUID)

Increments the player's luck counter by one.

Link copied to clipboard
fun isInCombat(playerId: UUID, nowTicks: Long, cooldownTicks: Long): Boolean

Checks if the player is currently considered to be in combat.

Link copied to clipboard
fun isOnEncounterCooldown(playerId: UUID, nowTicks: Long, cooldownTicks: Long): Boolean

Checks if the player is currently on encounter cooldown.

Link copied to clipboard
fun markActionFlag(playerId: UUID, flag: String): Boolean

Marks a one-time action flag for the player. Returns true if newly set.

Link copied to clipboard
fun markAskedInterviewQuestionKey(playerId: UUID, questionKey: String): Boolean

Marks a normalized non-AI interview question key as asked for the player.

Link copied to clipboard
fun markCombat(playerId: UUID, nowTicks: Long)

Records the current time as the player's last combat time.

Link copied to clipboard
fun markEncountered(playerId: UUID)

Marks the player as having encountered the Lorekeeper NPC for the first time.

Link copied to clipboard
fun markEncounterTime(playerId: UUID, nowTicks: Long)

Records the current time as the player's last encounter time.

Link copied to clipboard
fun nextQuestionStart(playerId: UUID, poolSize: Int, questionsPerInterview: Int): Int

Gets the next interview question starting index and advances the rotation.

Link copied to clipboard

Queues an investigation lead for a target player.

Link copied to clipboard

Queues an unresolved investigation mention for later resolution.

Link copied to clipboard
fun registerKnownPlayerName(playerId: UUID, playerName: String): Boolean

Records a player's canonical name and normalized aliases for later mention resolution.

Link copied to clipboard
fun registerSettlementChunk(playerId: UUID, chunkKey: Long, maxEntries: Int): Boolean

Registers a chunk as part of the player's settlement. Returns true if newly added.

Link copied to clipboard
fun reprocessUnresolvedInvestigationLeads(maxEntriesPerPlayer: Int, maxLeadAgeMillis: Long): Int

Attempts to resolve unresolved mentions into queued investigation leads.

Link copied to clipboard
fun resetChunkStay(playerId: UUID)

Resets the player's chunk stay counter to zero.

Link copied to clipboard
fun resetLuck(playerId: UUID)

Resets the player's luck counter to zero.

Link copied to clipboard
fun resolvePlayerIdForMention(mention: String, excludePlayerId: UUID? = null): UUID?

Resolves a free-form player mention to a unique known player ID.

Link copied to clipboard
fun setRepScore(playerId: UUID, value: Int)

Sets the player's reputation score.

Link copied to clipboard
fun updateChunkStay(playerId: UUID, chunkKey: Long): Long

Updates the player's chunk stay duration and returns the new tick count.