MarketListing
Market listing model — fields, YAML serialization, and ItemStack recreation.
Based on GrzybcioRynek 1.0.3 and web 0.1.0 source.
MarketListing (model/MarketListing.java) is an active listing. It implements ConfigurationSerializable and is registered in MarketPlace.onEnable via ConfigurationSerialization.registerClass(MarketListing.class).
Fields
| Field | Type | Meaning |
|---|---|---|
id | int | listing ID (StorageManager.nextId) |
seller | UUID | seller |
sellerName | String | nick at list time; missing → "Nieznany" |
item | ItemStack | stored item |
price | double | fixed price |
timestamp | long | System.currentTimeMillis() at creation |
oraxenId | String | Oraxen ID or null |
nexoId | String | Nexo ID or null |
Constructor: new MarketListing(id, seller, sellerName, item, price, timestamp, oraxenId, nexoId).
There is no “active / reserved” field. Reservation during buy is in memory: MarketManager.reservedListings.
Serialization to listings.yml
serialize() writes: id, seller (UUID as string), sellerName, item, price, timestamp. oraxenId / nexoId only when non-null.
deserialize(Map) requires item via ItemStackSerializer.parse. Missing item:
IllegalArgumentException: Brak przedmiotu w ofercie #<id>Missing number for id / price / timestamp:
IllegalArgumentException: Brak lub nieprawidłowa wartość dla: <klucz>StorageManager.parseListing also accepts the older Map format and calls MarketListing.deserialize. Damaged item: log Pominięto oferte #<id> - brak przedmiotu.
Creation
StorageManager.createListing(seller, sellerName, item, price, oraxenId, nexoId):
id = nextId++timestamp = System.currentTimeMillis()- add to in-memory list
- synchronous
save()tolistings.yml
Nexo/Oraxen IDs are set by MarketManager.sellItem via CustomItemsHook.getNexoId / getOraxenId before taking the item from the hand.
Recreating the item
On buy, remove, and expiry the item goes through CustomItemsHook.recreateItem(listing):
- clone stored
ItemStack(enchantments, PDC, name); - rebuild from pack ID only when stored type is AIR.
Expiry
A listing expires when now - timestamp > listing-expiry-days (default 7 days). Timer in MarketPlace: every 30 minutes. A reserved listing (isListingReserved) is skipped.
Related models
| Class | Role |
|---|---|
MarketTransaction | buy flow (UUID-string ID, states, fee) |
BrowseContext | GUI filter: category, sort, page, query, seller, favorites |
SortMode | CHEAPEST, EXPENSIVE, NEWEST, OLDEST, MOST_AMOUNT, LEAST_AMOUNT |
MailboxEntry | item return (reason, previous price) |
PriceAlert | price alert |
SellerRating | rating 1–5 linked to transactionId |