# brothergaming52/curiospaper architecture

> Architecture diagram of the GitHub repository brothergaming52/curiospaper, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-02-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/brothergaming52/curiospaper
- Repository: https://github.com/brothergaming52/curiospaper

## Overview

##### 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

## Diagram (Mermaid)

```mermaid
graph TB
    %% External Actors
    MC["Minecraft Client"]:::external
    ExtPlugin["External Plugin"]:::external

    %% Initialization Layer
    subgraph "Initialization Layer"
        CM["ConfigManager"]:::core
        SC["SlotConfiguration"]:::core
        RPM["ResourcePackManager"]:::core
        RPHost["ResourcePackHost"]:::http
        RPServer["ResourcePackServer"]:::http
        CM -->|"loads config.yml"| SC
        CM -->|"init slot settings"| SM
        RPM -->|"registers assets"| RPHost
        RPM -->|"spawns server"| RPServer
    end

    %% API Layer
    subgraph "API Layer"
        CP["CuriosPaper"]:::core
        API["CuriosPaperAPI (interface)"]:::api
        APIImpl["CuriosPaperAPIImpl"]:::api
        ExtPlugin -->|"calls API"| API
        CP -->|"getCuriosPaperAPI()"| API
        API -->|"delegates"| APIImpl
    end

    %% In-Game Interaction Layer
    subgraph "In-Game Interaction Layer"
        MC -->|"issues commands"| BaublesCmd
        MC -->|"issues commands"| CuriosCmd
        MC -->|"issues commands"| EditCmd

        BaublesCmd["BaublesCommand"]:::core
        CuriosCmd["CuriosCommand"]:::core
        EditCmd["EditCommand"]:::core

        BaublesCmd -->|"opens GUI"| AccessGUI
        CuriosCmd -->|"opens GUI"| AccessGUI
        EditCmd -->|"opens GUI"| EditGUI

        subgraph GUI
            AccessGUI["AccessoryGUI"]:::gui
            EditGUI["EditGUI"]:::gui
            AbilityEditor["AbilityEditorGUI"]:::gui
            LootBrowser["LootTableBrowser"]:::gui
            MobEditor["MobDropEditor"]:::gui
            RecipeEditor["RecipeEditorGUI"]:::gui
            TradeEditor["TradeEditor"]:::gui
        end

        MC -->|"click slot"| InvListener
        InvListener["InventoryListener"]:::core
        InvListener -->|"fires"| EquipEvent
        EquipEvent["AccessoryEquipEvent"]:::core
        EquipEvent -->|"update"| SM
        EquipEvent -->|"update"| IDM
    end

    %% Data & Managers
    subgraph "Data Layer & Persistence"
        SM["SlotManager"]:::data
        IDM["ItemDataManager"]:::data
        CIM["ChatInputManager"]:::data
        subgraph Models
            AD["AbilityData"]:::data
            ID["ItemData"]:::data
            LD["LootTableData"]:::data
            MDD["MobDropData"]:::data
            RD["RecipeData"]:::data
            VTD["VillagerTradeData"]:::data
        end
        SM --> Models
        IDM --> Models
        AutoSave["AutoSaveTask"]:::persist
        AutoSave -->|"writes YAML"| YML["YAML Files"]:::persist
        MC -->|"fetches pack"| RPServer
    end

    %% Resource Pack HTTP Service
    subgraph "Persistence & External Services Layer"
        RPServer -->|"serves ZIP"| MC
        AutoSave
    end

    %% Click Events
    click CM "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/config/ConfigManager.java"
    click SC "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/config/SlotConfiguration.java"
    click RPM "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/resourcepack/ResourcePackManager.java"
    click RPHost "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/resourcepack/ResourcePackHost.java"
    click RPServer "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/resourcepack/ResourcePackServer.java"
    click CP "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/CuriosPaper.java"
    click API "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/api/CuriosPaperAPI.java"
    click APIImpl "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/api/CuriosPaperAPIImpl.java"
    click BaublesCmd "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/command/BaublesCommand.java"
    click CuriosCmd "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/command/CuriosCommand.java"
    click EditCmd "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/command/EditCommand.java"
    click IDM "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/manager/ItemDataManager.java"
    click CIM "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/manager/ChatInputManager.java"
    click SM "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/manager/SlotManager.java"
    click AutoSave "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/util/AutoSaveTask.java"
    click AccessGUI "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/inventory/AccessoryGUI.java"
    click EditGUI "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/inventory/EditGUI.java"
    click AbilityEditor "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/inventory/AbilityEditorGUI.java"
    click LootBrowser "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/inventory/LootTableBrowser.java"
    click MobEditor "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/inventory/MobDropEditor.java"
    click RecipeEditor "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/inventory/RecipeEditorGUI.java"
    click TradeEditor "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/inventory/TradeEditor.java"
    click InvListener "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/listener/InventoryListener.java"
    click EquipEvent "https://github.com/brothergaming52/curiospaper/blob/main/src/main/java/org/bg52/curiospaper/event/AccessoryEquipEvent.java"

    %% Styles
    classDef core fill:#cce5ff,stroke:#004085;
    classDef api fill:#d4edda,stroke:#155724;
    classDef gui fill:#fff3cd,stroke:#856404;
    classDef data fill:#ffe5b4,stroke:#cc8400;
    classDef persist fill:#f8d7da,stroke:#721c24;
    classDef http fill:#e2e3e5,stroke:#6c757d;
    classDef external fill:#d1ecf1,stroke:#0c5460;
```
