How brothergaming52/curiospaper works
Project Type & Purpose
• CuriosPaper is a server-side plugin for PaperMC (Minecraft 1.21+) that provides an accessory-slot API layer.
• It adds a configurable accessory GUI, exposes a Java API for other plugins, handles resource-pack generation/hosting, and persists player data in YAML.
Main Components
a. Core Plugin Loader
• CuriosPaper.java (main JavaPlugin entrypoint)
b. API Facade
• CuriosPaperAPI (interface)
• CuriosPaperAPIImpl (implementation)
c. Command Handlers
• BaublesCommand, CuriosCommand, EditCommand
d. Configuration
• ConfigManager (loads config.yml)
• SlotConfiguration (per-slot settings)
e. Data Layer & Persistence
• ItemDataManager, ChatInputManager, SlotManager
• Data classes (ItemData, AbilityData, etc.)
• AutoSaveTask writes to YAML storage
f. GUI / Inventory Views
• AccessoryGUI, EditGUI, AbilityEditorGUI, etc.
g. Event Listeners
• AbilityListener, InventoryListener, PlayerListener, etc.
• Fires AccessoryEquipEvent (EQUIP, UNEQUIP, SWAP)
h. Resource Pack System
• ResourcePackManager (builds/merges assets)
• ResourcePackHost & ResourcePackServer (embedded HTTP server)
• HttpPacketHandler (serves ZIP)
i. Utilities
• LootTableFetcher, ElytraBackSlotHandler, etc.
Relationships & Data Flows
• Startup:
ConfigManager → initializes SlotConfiguration → SlotManager, GUI settings, storage & performance settings
ResourcePackManager registers assets, spawns HTTP server
• API Registration:
CuriosPaper.getInstance() → getCuriosPaperAPI() → external plugins can call tagAccessoryItem, getEquippedItems, etc.
• Player Interaction:
Player issues /baubles → BaublesCommand → AccessoryGUI.open() → GUI rendered to client
Player clicks an accessory slot → InventoryListener catches click → fires AccessoryEquipEvent → managers update in-memory data → optional NBT tagging
• Persistence:
AutoSaveTask scheduled → iterates cached player data → writes YAML via ItemDataManager
On quit: unload data if configured
• Resource Pack Hosting:
ResourcePackManager builds ZIP from src/main/resources/resources/assets + plugin-registered assets → ResourcePackServer listens on configured host:port → Minecraft client fetches pack on join
Architectural Patterns & Principles
• Modular layering: configuration, API, commands, GUI, events, data, external services
• MVC style for GUI: Views (Inventory GUIs), Controllers (listeners & commands), Models (accessory data)
• Facade pattern: CuriosPaperAPI hides internal complexity
• Singleton/Manager pattern for ConfigManager, SlotManager, ResourcePackManager
• Event-driven via PaperMC’s event bus
• Builder/Factory for resource pack assembly