GrzybcioRynek

Listings

MarketListing model, listing from main hand, and IDs from next-id in listings.yml.

Compatible with: GrzybcioRynek 1.0.3Minecraft 26.2Web 0.1.0

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

FieldTypeDescription
idintUnique, from next-id (auto-increment)
sellerUUIDSeller
sellerNameStringNick at listing time
itemItemStackClone of the hand stack (Bukkit serialize)
pricedoubleFixed price
timestamplongSystem.currentTimeMillis() — expiry base
nexoIdString / nullNexo ID if hook detected the item
oraxenIdString / nullOraxen ID, similarly
yaml
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: 2

next-id at start = max(saved next-id, largest id + 1).

How to list

  1. Item in main hand (not off-hand).
  2. /market sell <price> or /wystaw <price> (market.use + market.sell).
  3. Validation: price finite and within settings.min-pricesettings.max-price.
  4. Cooldown anti-abuse.listing-cooldown-seconds (when anti-abuse is enabled).
  5. Limit settings.max-listings-per-player (active listings for that UUID).
  6. Listing fee (listing-fee-percent) — Vault withdraw before save; on error item returns, fee is refunded.
  7. Hand cleared (setItemInMainHand(null)), listing saved, ListingCreatedEvent, AlertService.checkListing.

The entire hand stack goes to the market (amount preserved).

Limit and price

yaml
settings:
  max-listings-per-player: 10
  min-price: 1.0
  max-price: 1000000.0

Limit exceeded: sell.limit-reached. Bad price: sell.invalid-price.

Removal

ActionMailbox reasonWho gets the item
/market remove ownerremovedOwner (inventory or mailbox)
/market admin removeadmin-removedSeller
Expiry / forceexpireexpiredSeller
PurchaseBuyer (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.