Repository navigation
Paper 26.3 support, storage and Redis sync fixes - #23
Conversation
- 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.
|
Added the tested fixes in 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. ValidationTests ran on Paper 26.3 build 249 and Folia 26.3 build 6 alpha, using the exact JARs identified below.
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
Exact tested JAR SHA-256 hashesReproduction 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
left a comment
There was a problem hiding this comment.
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.
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
messages.yml: now version 12.Transaction.Away,AwayEntry,HistoryandHistoryEntryare replaced byAwayHeader,HistoryHeaderandLine.Paper 26.3
NoSuchFieldError: MAP_COLOR).Storage
TNE-Storagethread./tne reload,/tne reloaddbandData.Sync.ReloadRedis cross-server sync
tne:sync) with automatic reconnect. Changes made while Redis or a connection was down are delivered once it is back.Core.ServerID.Transactions
/transactionsshows history again after a restart./transaction awayworks for players. It previously opened a menu that was never registered.Transaction.DateFormat.tne.transaction.history.other.Other fixes
createPlayerAccount(String)no longer replaces existing accounts or scans every player data file.loading/importingsets are now thread-safe and are cleared on errors and logout.Testing
On Paper 26.3 test servers with MariaDB and Redis:
reloaddband restart with no lost changes.messages.ymlwas updated to v12 and the history/away output was checked.AI Usage notice
This release contains AI-generated code, which I have reviewed and am using in production.