Adding features
Real layer order for a new market feature — model, YAML, GUI, command, Wiki.
Based on GrzybcioRynek 1.0.3 and web 0.1.0 source.
A new feature in 1.0.3 goes through the same layers as mailbox, alerts, and ratings. Below is the real order, not a wish list.
1. Model in model/
A data class (like MailboxEntry, PriceAlert, SellerRating). Fields that must survive restart must serialize to YAML.
2. Persistence
- Listing / outbox / pending data →
StorageManager+listings.yml(sync save). - History, mailbox, favorites, alerts, ratings, TX →
ExtendedDataStore+market-data.yml(saveAsync, atomic write).
Do not add a third file without reason — reload only loads these two stores.
3. Key in config.yml + ConfigManager
Add the key and load it in ConfigManager.reload() with a default. An enabled flag must actually gate behavior (compare favorites.enabled vs stats.enabled, which is loaded and never checked).
4. Message in messages.* + MessageManager
All player text lives in config.yml under messages. There is no separate messages.yml. ensureMessageDefaults() fills missing keys on reload — add a new key there and in config.yml.
5. Service / manager
Business logic in managers/ (or extend MarketManager if you mutate listings / money). Keep economy and listing mutations under globalLock and away from reserved IDs.
6. GUI in inventory/impl + button
New class *GUI extends InventoryGUI, opened via GUIManager.openGUI.
The browse action bar (slots 45–53) is hardcoded in MarketBrowseGUI. A new browse button needs a Java change, not just gui.yml.
Listing / confirm / category slots — gui.yml + GuiConfigManager.
7. Command in MarketCommand
Add a case in onCommand and an entry in onTabComplete. Keep Polish aliases next to English ones (pattern my/moje). /wystaw and /aukcje are separate classes — do not put new market logic there.
8. Permission in plugin.yml — and a real check
An entry in plugin.yml does nothing until Java calls hasPermission. Currently enforced: market.use, market.sell, market.reload, market.admin. market.history, market.mailbox, market.alerts are in YAML (default: true) and are not checked in Java.
9. Optional event in api/event
Only if another plugin needs to react. 1.0.3 events are not Cancellable.
10. Optional PAPI in PlaceholderHook
Expansion identifier: grybciorynek. Cache refreshed every 20 ticks. New placeholder = new case in onRequest + entry in PLACEHOLDERS.md.
11. Cover with MarketSelfTest
/market admin selftest (FakePlayer SellerBot/BuyerBot or two online players). A new path that mutates listings/money should get an assertion in MarketSelfTest.run.
12. Wiki + navigation + index
- Markdown file under
Wiki/content/...with frontmatter (title,description,keywords). hrefentry inWiki/src/lib/navigation.ts.npm run indexinWiki/(scripts/validate-docs.mjs— every href must have a file).
Without step 12 the page will not appear in the sidebar, and npm run index will fail if the href exists but the file does not.