GUI system
InventoryGUI, GUIManager, and market screens — what is in gui.yml vs hardcoded.
Based on GrzybcioRynek 1.0.3 and web 0.1.0 source.
GUI is a normal Bukkit inventory. GUIManager maps open Inventory → InventoryHandler. GUIListener forwards click / open / close.
Skeleton
GUIManager.openGUI(gui, player)
→ registerHandledInventory
→ player.openInventory
GUIListener.onOpen → InventoryGUI.decorate(player)
GUIListener.onClick → event.cancel + button consumer (top inventory only)
GUIListener.onClose → unregisterInventory
InventoryGUI:
createInventory()— size and title;addButton(slot, InventoryButton)— icon creator + click consumer;onClickcancels the event; ignores clicks in the player inventory.
InventoryButton has creator(Player → ItemStack) and consumer(InventoryClickEvent).
Screens (inventory/impl)
| Class | Opened by |
|---|---|
MarketBrowseGUI | /market, /aukcje, search |
MarketCategoryGUI | Categories button |
MarketDetailGUI | click listing in browse |
MarketConfirmGUI | Buy in detail |
MyListingsGUI | /market my |
FavoritesGUI | /market favorites |
HistoryGUI | /market history |
MailboxGUI | /market mailbox |
AlertsGUI | /market alerts |
StatsGUI | /market stats |
SellerProfileGUI | profile button in detail |
Titles and lore: messages.gui.* in config.yml (via MessageManager). Browse/confirm slot layout: gui.yml (GuiConfigManager).
What is in gui.yml
browse:
size: 54 # actual browse size
border-slots: [...]
listing-slots: [10–16, 19–25, 28–34]
categories: # slot + material in MarketCategoryGUI
pagination: { previous: 39, page: 40, next: 41 }
filler: { enabled: true, material: BLACK_STAINED_GLASS_PANE }
confirm:
size: 27
slots: { confirm: 11, item: 13, cancel: 15 }
confirm-material / cancel-material
filler: ...settings.gui-rows: 6 is loaded (ConfigManager.guiRows) and never used.
Hardcoded browse bar
In MarketBrowseGUI slots 45–53 are fixed in code, not in YAML:
| Slot | Button |
|---|---|
| 45 | Search (chat: ChatInputManager) |
| 46 | Sort (SortMode.next()) |
| 47 | Categories |
| 48 | Mailbox |
| 49 | Stats |
| 50 | Alerts |
| 51 | Favorites |
| 52 | My listings |
| 53 | History |
Moving listing-slots onto 45–53 overlaps the action bar. Empty market with bad slots or no listings / search filter — see GUI.
Data on screen
ListingQueryService.query(BrowseContext, viewer):
- all listings from
StorageManager; - category filter (
MarketCategory.matches); - seller filter;
ItemSearchUtil.matches(material, display, lore, nexo/oraxen ID, nick,#id);- optionally favorites only;
- sort
SortMode(defaultNEWEST).
Pagination: listing-slots.length = items per page.
Categories
Enum MarketCategory: ALL, TOOLS, WEAPONS, ARMOR, BLOCKS, FOOD, FARMING, REDSTONE, DECORATIONS, POTIONS, ENCHANTED_BOOKS, OTHER.
Axes (*_AXE) are in WEAPONS, not TOOLS.
Chat instead of Anvil
Search from GUI, alerts, rating, and relist go through ChatInputManager + ChatInputListener. Cancel with: cancel or anuluj.