GrzybcioRynek

StorageManager and ExtendedDataStore

listings.yml (sync) and market-data.yml (async, atomic write) — listings, outbox, history.

Compatible with: GrzybcioRynek 1.0.3Minecraft 26.2Web 0.1.0

Based on GrzybcioRynek 1.0.3 and web 0.1.0 source.

Two stores, two files. Listings live in StorageManager. History, mailbox, favorites, alerts, and ratings — in ExtendedDataStore.

StorageManager — listings.yml

File: plugins/GrzybcioRynek/listings.yml. Write is synchronous (dataConfig.save).

YAML keys:

KeyContents
listingslist of MarketListing
next-idnext ID (max of file and listings)
expiry-outbox.<id>expired return journal (seller, item, price, reason)
pending-returns.<uuid>item queue when mailbox disabled / legacy
pending-sales.<uuid>sale notifications for offline players

API

MethodAction
createListing(...)nextId++, add, save()
removeListing(int)remove, save()
restoreListing(listing)restore after failed buy (same ID)
getListing / getAllListings / getListingsBySellerin-memory read
returnListingToSeller(listing, reason)inventory or mailbox
backupListings()copy listings.yml.bak (REPLACE_EXISTING)
removeExpiredListings()under globalLock, skips reserved
processExpiryOutbox()delivers journal
addPendingSaleNotification / deliverPendingSaleNotificationsnotifications by UUID
deliverPendingReturnspending-returns per-item (save before give)

addPendingReturnPublic is used when mailbox.enabled: false and the seller is offline (MailboxService.deposit).

Expiry outbox

So a crash does not lose the item: first write expiry-outbox.<id>, then remove the listing in the same save(), then processExpiryOutbox. Outbox clears the entry before delivery; if online + inventory space — expiry.returned, otherwise mailbox.

Timer: startup + every 30 minutes.

Write errors

text
Nie można utworzyć pliku listings.yml!
Nie można zapisać pliku listings.yml!
Nie udało się utworzyć backupu listings.yml: <msg>
Pominięto oferte #<id> - brak przedmiotu.
Nie udalo sie wczytac oferty ze starszego formatu: <msg>

ExtendedDataStore — market-data.yml

File: plugins/GrzybcioRynek/market-data.yml. Mutations call saveAsync()runTaskAsynchronously → synchronized save().

Atomic write: market-data.yml.tmpFiles.move(..., ATOMIC_MOVE), fallback plain move, finally direct data.save.

YAML sections: favorites.<uuid>, mailbox.<uuid>, alerts.<uuid>, ratings, transactions.

API (selected)

MethodAction
toggleFavorite / removeFavoriteEverywherefavorites by listing ID
addMailbox / takeMailboxEntry / restoreMailboxEntrymailbox atomically
addAlert / removeAlert / getAllAlertsalerts (limit price-alerts.max-per-player)
addRating / hasRated / getAverageRatingratings 1–5
addTransaction / updateTransaction / getTransactionTX by string-ID
getCompletedTransactionsonly TransactionState.COMPLETED
getBuyerHistory / getSellerHistorysorted descending by time
getPriceHistory(material, nexoId, oraxenId)identity: Nexo first, then Oraxen, then material
pruneHistory()removes COMPLETED older than history.retention-days (default 30)
flushAndSave()synchronous save (reload)
backup()market-data.yml.bak

MarketAPI.getCompletedTransactions() / getTransaction(String) read this store.

Write errors

text
Nie można utworzyć market-data.yml
Nie można zapisać market-data.yml: <msg>
Nie udało się utworzyć backupu market-data.yml: <msg>
Pominięto transakcję: <msg>
Note

listings.yml is compatible with the older Map format. market-data.yml appeared in 1.0.3.