Skip to content

Paper 26.3 support, storage and Redis sync fixes - #23

Merged
GoodrichDev merged 15 commits into
BitworksMC:mainfrom
vilhu-github:main
Nov 15, 2026
Merged

GoodrichDev merged 15 commits into
BitworksMC:mainfrom
vilhu-github:main

Conversation

@vilhu-github

Copy link
Copy Markdown

0.1.5.4: Paper 26.3 support, storage and Redis sync fixes

Adds Paper 26.3 support and fixes lost balance changes, slow shutdowns, Redis cross-server sync and the transaction commands.

Breaking

  • Redis sync: every server must run 0.1.5.4. Older versions cannot exchange sync messages with it.
  • messages.yml: now version 12.
    • Transaction.Away, AwayEntry, History and HistoryEntry are replaced by AwayHeader, HistoryHeader and Line.
    • Existing files update automatically, but customised versions of the old messages need to be redone.

Paper 26.3

  • Supports Paper 26.3.
  • Fixed TNE failing to enable (NoSuchFieldError: MAP_COLOR).
  • Fixed decorated pot item conversion.
  • Fixed errors with inline (unregistered) registry values, e.g. goat horns with a custom instrument.

Storage

  • All saving runs on one TNE-Storage thread.
    • Autosaves no longer overlap or create new Craft Scheduler threads.
    • Shutdown no longer waits 10 seconds for TNE.
  • Fixed balance changes being lost:
    • when plugins used Vault from several threads at once
    • during autosaves
    • on /tne reload, /tne reloaddb and Data.Sync.Reload
  • Reloads are cancelled instead of wiping balances when unsaved changes cannot be saved, e.g. while the database is down.
  • Failed saves are retried.
  • One failing account or receipt no longer blocks the others.
  • Fixed item currency balances of online players not being saved on shutdown.
  • Item currency balances are read from inventories only on the server thread or inside a transaction. Autosaves copy them into wallets on the server thread first.

Redis cross-server sync

  • Balance changes: servers send changes instead of resulting balances, so simultaneous changes on several servers all count. Previously over half could be lost.
  • Transport: uses a Redis stream (tne:sync) with automatic reconnect. Changes made while Redis or a connection was down are delivered once it is back.
  • Notifications: cross-server player notifications work again.
  • Server ID check: warns when two servers share the same Core.ServerID.

Transactions

  • /transactions shows history again after a restart.
    • It includes payments the player received, and no longer merges transactions made in the same second.
    • Receipt tables are migrated on MySQL and MariaDB so every participant is stored.
  • /transaction away works for players. It previously opened a menu that was never registered.
  • History and away lines show date, type, signed amount and the other party instead of the receipt UUID. The UUID is in the hover text, and clicking shows the details. New key Transaction.DateFormat.
  • Viewing another player's history now requires tne.transaction.history.other.

Other fixes

  • Fixed a server crash when tab-completing a TNE command after TNE was disabled, e.g. after a failed startup.
  • Vault createPlayerAccount(String) no longer replaces existing accounts or scans every player data file.
  • Account tab completion suggests offline accounts only once a name is typed, at most 50.
  • The loading/importing sets are now thread-safe and are cleared on errors and logout.

Testing

On Paper 26.3 test servers with MariaDB and Redis:

  • Storage: concurrent deposits, reloaddb and restart with no lost changes.
  • Redis sync: 200 + 200 concurrent deposits on two servers ended at the same balance.
  • Redis outage: changes made while Redis was stopped were delivered after reconnect.
  • Item conversion: item conversion audit passed.
  • Fixes vs old jar: compared permission, Vault and tab-completion behaviour against the previous jar.
  • Messages: a v11 messages.yml was updated to v12 and the history/away output was checked.
  • Not covered: item currencies with real online players were not tested in-game.

AI Usage notice

This release contains AI-generated code, which I have reviewed and am using in production.

vilhu-github and others added 13 commits October 20, 2026 14:56
- Replace TNIL's PaperMapColorComponent with a copy that disables itself
  when DataComponentTypes.MAP_COLOR is missing (removed in Paper 26.3),
  fixing NoSuchFieldError on enable.
- Register the String -> Material conversion TNIL uses for decorated pot
  sherds, fixing DECORATED_POT round trips.

Verified with tests/paper-items on Paper 26.3-200 and 1.21.11-132.
Balance changes could silently disappear:
- Concurrent transactions (e.g. async Vault calls) wrote ending balances
  calculated from stale holdings; 16 threads x 500 deposits kept 2562/8000.
  Transactions now run under one lock and recalculate ending balances
  from current holdings before applying them.
- /tne reload, /tne reloaddb and Data.Sync.Reload replaced in-memory
  accounts with database data without saving first. They now flush.
- Saves cleared the dirty flag after writing, dropping changes made while
  a save ran. The flag is cleared before reading and restored on failure.
- Holdings are now written in one transaction per account and a failed
  write is retried, instead of being logged and forgotten.
- Online players are always saved when an item currency exists, since
  item balances change without marking the wallet dirty.
- Failed YAML saves no longer leave the file locked forever.

All writes now run on one TNE-Storage thread: autosaves can no longer
overlap or spawn Craft Scheduler threads, and shutdown flushes queued
saves. Plugin core's storage worker is stopped explicitly, removing a
10 second stall on every server stop.

tests/storage/SaveProbe covers concurrency, reloaddb and restart.
- SQL receipts were reloaded without participants, so after a restart no
  receipt matched any account and history showed nothing. Participants,
  modifiers and holdings are now loaded with one query per table.
- Receipt tables were keyed on the receipt id alone, so only the first
  participant (the payer) of each payment was stored and recipients never
  saw incoming payments. Keys now include the participant type; existing
  MySQL/MariaDB tables are widened on startup.
- History pages were keyed by timestamp, and receipts are stored with
  second precision, so all transactions within one second collapsed into
  one entry. Pages are now ordered lists, newest first, of the newest 200
  receipts instead of 200 arbitrary ones. Same fix for missed-transaction
  (away) history.
- Initiator shows the source (player or plugin, e.g. Vault) when a
  transaction has no paying account, instead of "None".
- Receipts are saved in one batched transaction instead of up to a dozen
  statements each; 8000 receipts went from ~60 s to ~2 s.
- Receipt load errors are logged instead of silently aborting the load.

SaveProbe now also checks a payment receipt survives a restart with both
participants.
- Reloads now hold the balance lock while saving and replacing cached
  accounts, and are cancelled (with a message) when an account could not
  be saved or saving times out after 20 s, instead of wiping in-memory
  balances while the database is down.
- Every save failure restores the dirty flag: runtime exceptions in SQL
  and YAML account saves, holdings reads that race a logout, and failed
  YAML holdings writes.
- One failing account no longer aborts the rest of a save pass, and one
  rejected receipt no longer keeps a whole batch unsaved; receipts
  without a source are stored as "Unknown".
- Join-time shared data reload runs before the joining account is
  restored, so its stale cached balance is not saved over newer data.

Tested on Paper 26.3 + MariaDB 11.4: SaveProbe passes; with the database
paused, /tne reloaddb is cancelled and balances stay intact, and after
it returns the reload succeeds and the balance is persisted.
Two servers sharing a database still overwrite each other's balances
unless they use different Core.Server.Name values or Redis sync. Also
fix the javadoc link to the removed flush() method.
Balance sync sent the resulting balance, so concurrent changes on two
servers overwrote each other: 400 deposits split over two servers kept
191. Servers now send the change with a unique ID; receivers drop
duplicates and add it to their own balance on the server thread under
the balance lock. A thread-local flag replaces plugin core's unsynced
"affected accounts" list to avoid sending received changes back.

TNE now runs Redis itself instead of plugin core's subscriber, which
stopped for good after a Redis restart and never listened to
tne:message. Messages go through one Redis stream (tne:sync): the
reader resumes from its last message after reconnecting and the
publisher retries in order, so nothing sent during an outage is lost.

Every message carries a per-run ID next to Core.ServerID; a server
copied with the same ServerID is detected and logged, and its messages
are still applied.

Tested with two Paper 26.3 servers, MariaDB and Redis 7: 200+200
concurrent deposits all applied on both servers; a deposit made while
Redis was stopped arrived after reconnect; duplicate ServerIDs warned
on both servers without losing changes.

Older TNE versions cannot exchange sync messages with this one.
Items can define values such as goat horn instruments inline instead of
referencing the registry. Paper throws when asked for their key, which
broke PlayerInteractEvent for such items. Registry-to-string conversion
now falls back to "tne:unregistered"; the preserved component still
restores the exact native value.

InventoryAudit gains an inline-instrument round trip, which failed
before and passes on Paper 26.3 and 1.21.11.
Paper keeps a disabled plugin's Brigadier commands but closes its class
loader. When TNE was disabled while the server ran (for example after
a failed startup), the next player tab completing a TNE command made
Lamp load a class through the closed loader, and the resulting
NoClassDefFoundError stopped the server tick loop.

On disable, TNE now removes its commands from the command map and,
through Paper's CommandNode#removeCommand, from the server dispatcher,
then resends command trees to online players.

Verified on Paper 26.3 and 1.21.11 by disabling TNE and tab completing
/money: previously an exception, now no suggestions and no dispatcher
node.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- /transactions checks tne.transaction.history.other before showing
  another account's history; the permission was defined but unused.
- Item balances are read from inventories only on the server thread or
  within a transaction. Saves, balance top and async balance checks use
  the wallet, which autosaves now refresh on the server thread first.
- Vault's name-based createPlayerAccount no longer replaces an existing
  account or scans every player data file for unknown names.
- Account tab completion lists offline accounts only once a name is
  typed, at most 50.
- The loading/importing sets are thread-safe and cleared on errors and
  logout, so a failed join cannot pin a player to the stored balance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
/transaction away opened a "transaction_away" menu that was never
registered, so players got no output. It now lists missed transactions
in chat, like the console path did.

History and away lines show the date, type, signed amount and the other
party (or whoever caused a give or take) instead of the receipt UUID.
The UUID moved to the hover text; clicking still opens the details.
The messages get new keys and config-version 12 so existing
messages.yml files pick them up.
@vilhu-github vilhu-github mentioned this pull request Nov 3, 2026
Closed
@BitworksMC BitworksMC deleted a comment from Zontyk Nov 13, 2026

Copy link
Copy Markdown
Member

Added the tested fixes in b2bd15fc. The commit is now part of this PR and is ready for maintainer review.

The fixes cover dropped Redis updates at shutdown, deleted accounts being recreated by stale saves, the shutdown scheduling exception, and Folia 26.3 packaging, scheduling and inventory ownership. YAML receipt loading/saving was also optimized.

Validation

Tests ran on Paper 26.3 build 249 and Folia 26.3 build 6 alpha, using the exact JARs identified below.

Check Result
Maven verification and PMD Passed
Item regressions, each platform 26 checks passed
Inventory audit, each platform 10,039 attempts, zero failing groups
Account lifecycle, each platform Delete/recreate, rename, stale saves, reload and restart passed
Storage concurrency, each platform 8,000 deposits preserved; expected final balance 8,003 survived restart with complete payment receipt
Online player, each platform Ownership checks, atomic rejection, inventory/ender snapshots, shutdown save and restart restoration passed
Receipt cache, each platform 8,002 files; content/order/count, external edits/deletions, sub-millisecond same-size edits and mutation isolation passed
Redis transport 38 checks passed, including durable retry and lost acknowledgements
Full Paper/Folia Redis integration 200 + 200 deposits converged to 400 on both; another 100 queued updates survived shutdown/restart, leaving 500 on both

Flush plus reload of 8,000 new receipts measured 4,918 ms on Paper and 4,789 ms on Folia, with no watchdog warnings in the final runs. The concurrency setup and administrative reload run in separate ticks; the timed reload includes flushing all unsaved receipts. All test processes were stopped.

Limits to consider before approval

  • Synchronous physical-item payments across different Folia regions are rejected before either participant changes. Virtual currency transactions remain supported.
  • Redis integration used separate YAML stores. Shared SQL persistence and shared-database reconciliation were not tested.
  • Large YAML reloads still block the caller for the duration of the flush/reload.
  • Redis history is bounded, and a receiver starts at the newest stream entry on startup; receiver downtime/reconciliation remains an existing design limitation.
Exact tested JAR SHA-256 hashes
Paper: 63957A046AFBEB29F86E603A711D452B5661E91B4F6E8D52FAA92D4B5ADF2C49
Folia: 9BC09F575089C8BD00E8C16B78FB81ECD966DB09DF7408CCD2711CDA8C7956FD

Reproduction probes and runners are included in tests/paper-items, tests/storage, and tests/redis. These runtime probes are for disposable test servers and stop the server when finished.

No PR approval or merge has been submitted.

@GoodrichDev GoodrichDev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved for 0.1.5.4 at 34309a7. GitHub Maven verification and PMD passed on Java 21. The runtime fixes were validated on Paper 26.3 build 249 and Folia 26.3 build 6 alpha; the follow-up release metadata commit adds the tested 26.3 compatibility entries for those platforms.

The detailed runtime results and supported-scope limitations are recorded in #23 (comment) and the repository documentation. This approval retains the documented restriction on synchronous cross-region physical-item payments in Folia and does not claim shared-SQL/Redis reconciliation coverage. The optional CodeSee check remains blocked by GitHub's fork-checkout protection.

@GoodrichDev
GoodrichDev merged commit 3083d5b into BitworksMC:main Nov 15, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants