WIP: Add ServerShop plugin — server-run global market for Paper/Purpur 1.21 #3
Reference in New Issue
Block a user
Delete Branch "copilot/create-server-shop-plugin"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds a new
servershop/Maven module implementing a server-run global market designed to coexist with CommunityMarket. The shop maintains a deliberately large buy/sell spread (default 25% sell multiplier → 75% spread) so player-to-player trades remain economically attractive.Module structure
category/—Categorydata class +CategoryRegistryloads 11 categories fromprices.yml, maps everyMaterialto a category with MISC fallbackpricing/—ItemPrice(buy/sell per unit, spread %) +PricingServiceresolves prices with per-item → per-category → global multiplier priority chaineconomy/— Vault wrapper; disables the plugin gracefully if no economy provider is foundgui/— Three 54-slot GUIs (MainCategoryGui,CategoryGui,ItemDetailGui), aGuiControllerper-player state tracker, andShopGuiListenerwhich cancels all non-intended interactions (shift-click, drag, number-swap)i18n/—LangManagerwithen_USandpt_PT; missing keys fall back toen_USstorage/— Async SQLiteTransactionLogger(schema: uuid, player, type, material, amount, unit_price, total, timestamp)command/—/shopopens the GUI;/shop reload(op) reloads config/prices/lang without restartPricing model
Anti-exploit
ItemUtil.canFit()checked before charging whenfull-inventory-behavior: CANCELInventoryClickEventandInventoryDragEventinside shop GUIs are cancelled by default; only whitelisted slots trigger actionsResources
prices.yml— 300+ items across 11 categories with sensible defaultslang/en_US.yml+lang/pt_PT.yml— full i18n coverageservershop/README.md— setup, pricing spread explanation, config reference, known limitationsOriginal prompt
You are an expert Paper/Purpur plugin developer. Build a professional Server Shop / Global Market plugin for Paper/Purpur 1.21.11 using Java 21 and Maven.
Project goal:
This is a server-run market (NOT player-to-player). It exists alongside my player marketplace plugin (CommunityMarket) and must be designed to support it economically by having a large spread between buy and sell prices (so players still prefer selling to other players).
Core concept:
================================================================================
================================================================================
================================================================================
2) GUI-only UX (MUST)
Commands:
/shop(alias/servershop) opens the main GUI.No other required commands for players; all interactions in GUI.
Main GUI:
Category GUI:
Item Detail GUI:
================================================================================
3) Pricing model (MUST)
We want a large gap between buy and sell prices to keep CommunityMarket valuable.
Implement pricing rules:
buyPrice(server sells to player)sellPrice(server buys from player)sellPrice = buyPrice * sellMultiplierwhere multiplier is LOW (e.g., 0.25) — configurable globally and per-category.Important:
================================================================================
4) Item coverage (MUST)
Exclude/handle:
State the decision clearly and make it configurable.
================================================================================
5) Buy and Sell mechanics (MUST)
Buying:
Selling:
Anti-exploit:
================================================================================
6) Configurability (MUST)
Provide
config.ymlwith:🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.