# cortezromeo/clansplus architecture

> Architecture diagram of the GitHub repository cortezromeo/clansplus, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cortezromeo/clansplus
- Repository: https://github.com/cortezromeo/clansplus

## Overview

- clansplus-api – provides the main interfaces, core enums, and abstract definitions for clan data, storage, and server interactions.
- clansplus-implement – contains version support and cross-version compatibility logic (e.g., CrossVersionSupport) ensuring the plugin runs on different Minecraft server implementations.
- clansplus-plugin – holds the actual plugin implementation with commands, event listeners, GUI/inventory managers, language configuration, file handling, and storage support. This module orchestrates the plugin functionality and integrates with external dependencies like DiscordSRV, PlaceholderAPI, Vault, etc.

##### Main Components
a. API Module:
– Represent it as a core “ClansPlus API” component that exposes the interfaces (for clan data, player data, clan management methods, etc.) and enums (CurrencyType, DatabaseType, SkillType, etc.).
b. Implementation Module:
c. Plugin Module:
– Break this down into several subcomponents:
- GUI/Inventory Management – include the extensive inventory files and classes responsible for player interactions (e.g., ClanMenuInventory, Settings, etc.).
- Command & Event Handling – show classes handling commands (like ClanCommand and ClanAdminCommand) and events (e.g., PlayerJoinListener, PlayerQuitListener).
- Storage/Data Managers – illustrate the plugin’s storage subsystem with different storage backends (H2, MySQL, YAML) and the PluginDataManager that handles the clan and player databases.
- Utility/Support Classes – highlight supporting components (e.g., DiscordSupport, PlaceholderAPISupport, VaultSupport) that integrate with soft-dependencies and external systems.

##### Relationships and Interactions
– Indicate that the Plugin Module is dependent on an underlying Implementation Module to abstract server version differences.
– In the storage area, illustrate that the PluginDataManager interacts with various storage implementations (H2, MySQL, YAML) and highlight that these classes abstract the data access layer.
– Showcase external dependencies: indicate connections from the Plugin Module to soft-dependent plugins (PlaceholderAPI, DiscordSRV, Vault) and external libraries used for configurations/updating (ConfigUpdater, XSeries, NBTEditor).

##### Architectural Patterns and Design Principles
– Emphasize the separation of concerns by clearly isolating the API (contracts and interfaces) from the concrete plugin implementation.
– Highlight use of dependency injection via Bukkit’s Services Manager to register and obtain the ClanPlus API. This decouples the API consumers from the implementation details.
– Note the adapter pattern used in the cross-version support (within clansplus-implement) which allows the same API to work across various server versions.
– The storage subsystem might utilize a strategy/pattern for switching database storage mechanisms (H2/MySQL/YAML) based on configuration.

##### Relevant Technologies/Frameworks
– Java 11 or newer (as required).
– Spigot/Paper and NMS for Minecraft server integration.
– Maven for build dependency management, as evident from the pom.xml files in each module.
– External libraries such as JetBrains Annotations, ConfigUpdater, XSeries, NBTEditor, and H2 database should be noted.

##### Essential Elements to Incorporate
– Labels: Each component/subcomponent should have a clear, descriptive label.
– Detail the external integration points, particularly for soft-dependent plugins like PlaceholderAPI, DiscordSRV, PlayerPoints, and Vault.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% ClansPlus API Module
    subgraph "ClansPlus API Module"
        A["ClansPlus API"]:::api
        AE["API Enums"]:::api
    end

    %% ClansPlus Implementation Module
    subgraph "ClansPlus Implementation Module"
        I["CrossVersionSupport"]:::impl
    end

    %% ClansPlus Plugin Module
    subgraph "ClansPlus Plugin Module"
        PC["Plugin Core"]:::plugin
        CH["Command Handling"]:::plugin
        EH["Event Handling"]:::plugin
        GI["GUI/Inventory Management"]:::plugin
        IF["Inventory Files"]:::plugin
        SM["Storage/Data Managers"]:::plugin
        EI["External Integrations"]:::ext
        UT["Utility/Support Classes"]:::util
    end

    %% Relationships within Plugin Module
    PC --> CH
    PC --> EH
    PC --> GI
    PC --> IF
    PC --> SM
    PC --> EI
    PC --> UT

    %% Plugin Module interactions with API Module
    CH -->|"calls"| A
    EH -->|"calls"| A

    %% Plugin Core uses version support
    PC -->|"uses-version"| I

    %% Click Events
    click A "https://github.com/cortezromeo/clansplus/tree/master/clansplus-api/src/main/java/com/cortezromeo/clansplus/api"
    click AE "https://github.com/cortezromeo/clansplus/tree/master/clansplus-api/src/main/java/com/cortezromeo/clansplus/api/enums"
    click I "https://github.com/cortezromeo/clansplus/blob/master/clansplus-implement/src/main/java/com/cortezromeo/clansplus/support/version/CrossVersionSupport.java"
    click PC "https://github.com/cortezromeo/clansplus/blob/master/clansplus-plugin/src/main/java/com/cortezromeo/clansplus/ClansPlus.java"
    click CH "https://github.com/cortezromeo/clansplus/tree/master/clansplus-plugin/src/main/java/com/cortezromeo/clansplus/command"
    click EH "https://github.com/cortezromeo/clansplus/tree/master/clansplus-plugin/src/main/java/com/cortezromeo/clansplus/listener"
    click GI "https://github.com/cortezromeo/clansplus/tree/master/clansplus-plugin/src/main/java/com/cortezromeo/clansplus/inventory"
    click IF "https://github.com/cortezromeo/clansplus/tree/master/clansplus-plugin/src/main/java/com/cortezromeo/clansplus/file/inventory"
    click SM "https://github.com/cortezromeo/clansplus/tree/master/clansplus-plugin/src/main/java/com/cortezromeo/clansplus/storage"
    click EI "https://github.com/cortezromeo/clansplus/tree/master/clansplus-plugin/src/main/java/com/cortezromeo/clansplus/support"
    click UT "https://github.com/cortezromeo/clansplus/tree/master/clansplus-plugin/src/main/java/com/cortezromeo/clansplus/util"

    %% Styles
    classDef api fill:#ffccff,stroke:#cc00cc,stroke-width:2px;
    classDef impl fill:#cce5ff,stroke:#0066cc,stroke-width:2px;
    classDef plugin fill:#ccffcc,stroke:#339933,stroke-width:2px;
    classDef ext fill:#ffffcc,stroke:#ffcc00,stroke-width:2px;
    classDef util fill:#ffedcc,stroke:#ff9900,stroke-width:2px;
```
