Skip to content

Keep a Codex journal per character - #2

Merged
ryanbarlow97 merged 5 commits into
mainfrom
per-character
Oct 14, 2026
Merged

ryanbarlow97 merged 5 commits into
mainfrom
per-character

Conversation

@ryanbarlow97

@ryanbarlow97 ryanbarlow97 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Each roleplay character now has its own Codex journal, so a new character can discover places and lore again and earn the discovery rewards again (for example the 50 Player EXP for a point of interest). Stacked on #1.

How it works. Codex loads a character's journal from plugins/Codex/characters/<character>.yml when its TLibs character session starts and saves it when the session ends (switch, quit, death or shutdown). Between characters, for example in the selection room, the player has no journal and nothing can be discovered, so no rewards fire without a record. A character's first session creates its file, so characters/ has one file for every character that has played.

Out-of-character reference. An entry the account found before this change, or any of its characters has found since (alive or dead), stays unlocked in /codex and its sub-pages stay openable, so players can still read what they have seen. Click actions on such entries run only when the entry has no click_actions_cooldown, since that cooldown is stored on the character's own entry. The hover text adds "Aldric and Mira can use this in character." (living characters only, the played one first), or "No character can use this in character." When the played character hasn't found it itself, it also adds "Aldric knows this only out of character." Codex reads the other characters' journals when a session starts; they can't change while the account is playing someone else. The three lines are configurable in messages.yml and are added to existing files. Rediscovery, rewards, category progress and placeholders stay per character.

Existing discoveries. No character inherits them, because the old account journals don't record which character found an entry. Each account's players/<account>.yml stays where it is and feeds the out-of-character reference. Its entries show as readable, with "No character can use this in character.", until a character finds them again. Every character, the most-played one included, rediscovers places and earns their rewards again.

Other changes. MySQL storage is removed: neither server used it, and making it per character would have been a second rewrite. Old mysql_database keys in a config are ignored. Saves now run on the main thread, which removes upstream's race between the async save task and players joining or leaving. The plugin needs TLibs (depend) and RPCharacters for character sessions. It doesn't list RPCharacters for load order, because RPCharacters soft-depends on Codex. /codex won't open between characters.

Follow-ups. RPCharacters' codex_percent_/codex_holders_ placeholders read plugins/Codex/players/. They need to read characters/ instead, so they count characters. That will be a separate RPCharacters PR, released together with this one.

Tests. JUnit and Mockito cover the file store, the out-of-character reference, session open and close, unreadable files and save failures. JaCoCo requires 100% line coverage of net.tfminecraft.codex.character; upstream code has no tests. mvn clean verify passes (24 tests).

🤖 Generated with Claude Code

ryanbarlow97 and others added 5 commits October 14, 2026 22:14
Load a character's discoveries from characters/<character>.yml when its
session starts and save them when it ends, so each character discovers
places and lore and earns their rewards for itself. Between characters
nothing can be discovered.

Each account's old players/<account>.yml goes to its RPCharacters heir once
heirs are known, or to its most-played living character if it has no
reviewed heir; the old file moves to players-migrated/. Other characters
start empty.

Drop MySQL storage, which neither server used. Saves now run on the main
thread.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An entry any of the account's characters has found, alive or dead, now
shows unlocked for out-of-character reference, sub-pages included. Its
hover text names the living characters who can use it in character, and
says when the played character knows it only out of character.
Rediscovery, rewards and progress counts stay per character.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Entries known only out of character run click actions only when they
  have no click cooldown, since the cooldown lives on the character's own
  entry.
- /codex menus need a character in play; between characters they answer
  noCharacterInPlay and item actions close the menu.
- /codex resetplayer * also resets account files not yet moved.
- A reviewed heir deleted since the review falls through to the
  most-played rule; earlier players-migrated/ copies are never replaced.
- Warn once if heirs are still unknown after 60 seconds; refresh the
  out-of-character view after the start-up move; a failed roster lookup
  falls back to the played character's own journal.
- Depend only on TLibs: RPCharacters soft-depends on Codex, so depending
  on it back would make a load cycle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The old account journals don't record which character found an entry, so
no character inherits them. players/<account>.yml stays in place as the
account's out-of-character reference: its entries show as readable with
"No character can use this in character." until a character finds them
again. This removes the heir lookup, the start-up move and
players-migrated/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A journal that fails to save when its session ends stays in memory under
its character, is retried with every save, is reused if the character
returns first, and counts in the account's out-of-character reference.
Staff resets apply to it too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ryanbarlow97

Copy link
Copy Markdown
Contributor Author

Reviewed by Astra (GPT-6-Astra) over four read-only rounds (reports kept locally); every finding fixed, the last with tests for its exact scenario. Merging with admin bypass. Not released or deployed.

@ryanbarlow97
ryanbarlow97 merged commit 1621552 into main Oct 14, 2026
2 checks passed
@ryanbarlow97
ryanbarlow97 deleted the per-character branch October 14, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ effective changed lines (tests excluded in mixed PRs).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant