Listings
MarketListing model, listing from main hand, and IDs from next-id in listings.yml.
Based on GrzybcioRynek 1.0.3 and web 0.1.0 source.
A listing is com.example.marketplace.model.MarketListing. Storage: plugins/GrzybcioRynek/listings.yml. Creation: StorageManager.createListing from MarketManager.sellItem.
Model
| Field | Type | Description |
|---|---|---|
id | int | Unique, from next-id (auto-increment) |
seller | UUID | Seller |
sellerName | String | Nick at listing time |
item | ItemStack | Clone of the hand stack (Bukkit serialize) |
price | double | Fixed price |
timestamp | long | System.currentTimeMillis() — expiry base |
nexoId | String / null | Nexo ID if hook detected the item |
oraxenId | String / null | Oraxen ID, similarly |
listings:
- id: 1
seller: 069a79f4-44e9-4726-a5be-fca90e38aaf5
sellerName: Gracz
item: {==: org.bukkit.inventory.ItemStack, v: 1, type: DIAMOND_SWORD, amount: 1}
price: 1500.0
timestamp: 1730000000000
nexoId: my_sword # optional
oraxenId: steel_blade
next-id: 2next-id at start = max(saved next-id, largest id + 1).
How to list
- Item in main hand (not off-hand).
/market sell <price>or/wystaw <price>(market.use+market.sell).- Validation: price finite and within
settings.min-price…settings.max-price. - Cooldown
anti-abuse.listing-cooldown-seconds(when anti-abuse is enabled). - Limit
settings.max-listings-per-player(active listings for that UUID). - Listing fee (
listing-fee-percent) — Vault withdraw before save; on error item returns, fee is refunded. - Hand cleared (
setItemInMainHand(null)), listing saved,ListingCreatedEvent,AlertService.checkListing.
The entire hand stack goes to the market (amount preserved).
Limit and price
settings:
max-listings-per-player: 10
min-price: 1.0
max-price: 1000000.0Limit exceeded: sell.limit-reached. Bad price: sell.invalid-price.
Removal
| Action | Mailbox reason | Who gets the item |
|---|---|---|
/market remove owner | removed | Owner (inventory or mailbox) |
/market admin remove | admin-removed | Seller |
Expiry / forceexpire | expired | Seller |
| Purchase | — | Buyer (overflow → purchase-overflow) |
On remove: removeFavoriteEverywhere(id). A reserved listing (buyItem in progress) cannot be removed (buy.listing-locked).
Reservation
MarketManager.reservedListings holds IDs during purchase. Reload with a non-empty set is blocked. The expiry timer skips reserved listings.
Custom items
On listing, nexoId / oraxenId are saved (if the hook works). Recreation: CustomItemsHook.recreateItem — first clone the stored stack; rebuild from pack ID only when stored type is AIR. Details: Nexo, serialization.
What is missing
- Listing from off-hand or a GUI “drop item” flow.
- Editing price of an existing listing (there is mailbox relist: new listing, new ID).
- SQL — YAML only.