# minevn/dotman architecture

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

- Interactive diagram: https://gitdiagram.com/minevn/dotman
- Repository: https://github.com/minevn/dotman

## Overview

##### Overall System and Major Components
- Plugin Core Module: Represent the entry point (e.g., DotMan.kt) that boots the plugin and registers listeners/commands.
- Event Listener: DotManListener.kt handles server events (likely related to player donations or updates).
- Command Handlers: Group the different commands (AdminCmd, MainCmd, TopNapCmd) that receive and process user input.
- Configuration Handling: Show the config classes (FileConfig.kt, Language.kt, MainConfig.kt, Milestones, etc.) and how they load YAML configuration files (config.yml, messages.yml, mocnap.yml, and interface files in the /menu folder).
- GUI Components: Include the GUI classes (e.g., CardPriceUI, CardTypeUI) and resources for in-game menus.
- Donation/Payment Processing: Illustrate the card module that includes classes like Card, CardPrice, CardResult, CardType, and CardWaiting to manage donation card processing.
- Database Abstraction Layer: Separate the Data Access Objects (DAO) interfaces (e.g., ConfigDAO, LogDAO, PlayerDataDAO, etc.) and their implementations for different database types (H2 and MySQL). This separation emphasizes the use of the DAO pattern to abstract data storage.
- Provider Integration: Indicate the providers package and its types (GameBankCP, TheSieuTocCP) which interface with external recharge services.
- Utility Components: Capture utility classes (e.g., FormatUtils, Utils, TopUtils) that help with formatting and processing operations.
- Discord Integration: Include Discord configuration and integration (Discord.kt) for notifications or external communications.

##### Relationships and Interactions
- The Core Module initializes the plugin, registers commands, listeners, and loads configurations.
- Commands (such as /napthe and /topnap) when invoked, trigger corresponding command handler modules which interact with both database (recording donation histories and player data) and GUI components (for interactive menus).
- Config classes load parameters from the YAML files located in the resources folder; these configurations feed into GUI components and business logic.
- The plugin abstractly deals with external provider APIs via dedicated provider classes; these interactions are encapsulated behind the provider interfaces.
- The DAO layer interacts with the underlying SQL databases in two flavors (H2 for lightweight setups and MySQL for more robust setups), with clear migration scripts provided in the resources.
- Utility classes support the business logic in formatting data or managing layouts (especially for ranking or top donation computations).

##### Architectural Patterns and Design Principles
- Modularization: The project structure separates concerns well, with distinct packages for commands, configuration, database access, providers, and UI.
- DAO Pattern: Use of interfaces for data access wrapped by implementations for H2 and MySQL clearly shows an abstraction over the persistence layer.
- MVC-Like Separation: Although not a web application, the division between commands (input), configuration/data (model), and GUI (view) loosely follows a separation of concerns.
- Plugin Event-Driven Model: Leveraging listeners and event registrations typical for Minecraft plugin architecture.
- Dependency Injection (manual/through modular structure): Components likely reference and depend on each other in a controlled manner (e.g., configuration injected into command processing).

##### Specific Technologies and Frameworks
- Kotlin & Java: The primary languages for development.
- Gradle: Build tool as indicated by build.gradle.kts scripts.
- Minecraft Server APIs: The project makes use of the Bukkit/Spigot API for plugin integration.
- External Dependencies: Relies on PlayerPoints and PlaceholderAPI for additional server functionalities.
- External Service Integration: Providers for various mobile card APIs (gamebank, thesieutoc, etc.).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Plugin Initialization Subgraph
    subgraph "Plugin Initialization"
        DOT["Core Plugin Module"]:::core
        LIST["Event Listener"]:::core
        CMD["Command Handlers"]:::command
        CFG["Configuration Handling"]:::config
        DSC["Discord Integration"]:::discord
    end

    %% Command Handlers Details
    subgraph "Command Handlers"
        ADMIN["AdminCmd"]:::command
        MAIN["MainCmd"]:::command
        TOPNAP["TopNapCmd"]:::command
    end

    %% Configuration Handling Details
    subgraph "Configuration Handling"
        FILECFG["FileConfig"]:::config
        LANG["Language"]:::config
        MAINCFG["MainConfig"]:::config
        MILE["Milestones"]:::config
        MILEM["MilestonesMaster"]:::config
        CONFIGYML["config.yml"]:::config
        MSGYML["messages.yml"]:::config
        MOCNAP["mocnap.yml"]:::config
        MOCNAPTONG["mocnaptong.yml"]:::config
    end

    %% Discord Configuration Resource
    subgraph "Discord Resources"
        DSC_CFG["discord.yml"]:::discord
    end

    %% GUI Components Subgraph
    subgraph "GUI Components"
        CPUI["CardPriceUI"]:::gui
        CTUI["CardTypeUI"]:::gui
        LOAITHYML["loaithe.yml"]:::gui
        MENHGIA["menhgia.yml"]:::gui
    end

    %% Donation/Payment Processing Subgraph
    subgraph "Donation Processing"
        CARD["Card"]:::processing
        CARDPRICE["CardPrice"]:::processing
        CARDRESULT["CardResult"]:::processing
        CARDTYPE["CardType"]:::processing
        CARDWAIT["CardWaiting"]:::processing
    end

    %% Database Abstraction Layer Subgraph
    subgraph "Database Layer"
        DAO["DAO Interfaces"]:::db
        H2["H2 Implementations"]:::db
        MYSQL["MySQL Implementations"]:::db
        MIGR["Migrations"]:::db
    end

    %% Provider Integration Subgraph
    subgraph "Provider Integration"
        CP["CardProvider"]:::provider
        GAMEBANK["GameBankCP"]:::provider
        THESIEU["TheSieuTocCP"]:::provider
        GAMEBANKYML["gamebank.yml"]:::provider
        THESIEUTOCYML["thesieutoc.yml"]:::provider
    end

    %% Utility Components Subgraph
    subgraph "Utility Components"
        BOSS["BukkitBossBar"]:::utility
        FMT["FormatUtils"]:::utility
        TOPUTIL["TopUtils"]:::utility
        UTILS["Utils"]:::utility
    end

    %% Relationships
    DOT -->|"registers"| LIST
    DOT -->|"registers"| CMD
    DOT -->|"loads"| CFG
    DOT -->|"initializes"| DSC

    DSC -->|"uses config"| DSC_CFG

    %% Command Handlers interactions
    MAIN -->|"opens"| CPUI
    MAIN -->|"opens"| CTUI
    ADMIN -->|"executes admin tasks"| CARDWAIT
    TOPNAP -->|"triggers top donation view"| TOPUTIL
    CMD -->|"updates records"| DAO

    %% Configuration influences
    CFG -->|"configures UI"| CPUI
    CFG -->|"sets donation parameters"| CARD

    %% Donation Processing interactions
    CPUI -->|"initiates donation process"| CARD
    CARD -->|"stores transaction"| DAO
    CARD -->|"calls external API"| CP
     
    %% Provider Integration interactions
    CP -->|"invokes"| GAMEBANK
    CP -->|"invokes"| THESIEU

    %% Utility Components support
    FMT ---|"formats data"| CARD
    UTILS ---|"supports commands"| CMD

    %% Styling Classes Definitions
    classDef core fill:#D3D3D3,stroke:#000,stroke-width:2px;
    classDef command fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef config fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef gui fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef processing fill:#FFCBCB,stroke:#000,stroke-width:2px;
    classDef db fill:#FFDAB9,stroke:#000,stroke-width:2px;
    classDef provider fill:#FFC0CB,stroke:#000,stroke-width:2px;
    classDef utility fill:#DDA0DD,stroke:#000,stroke-width:2px;
    classDef discord fill:#66CDAA,stroke:#000,stroke-width:2px;

    %% Click Events
    click DOT "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/DotMan.kt"
    click LIST "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/DotManListener.kt"
    click ADMIN "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/commands/AdminCmd.kt"
    click MAIN "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/commands/MainCmd.kt"
    click TOPNAP "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/commands/TopNapCmd.kt"
    click FILECFG "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/config/FileConfig.kt"
    click LANG "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/config/Language.kt"
    click MAINCFG "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/config/MainConfig.kt"
    click MILE "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/config/Milestones.kt"
    click MILEM "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/config/MilestonesMaster.kt"
    click CONFIGYML "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/resources/config.yml"
    click MSGYML "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/resources/messages.yml"
    click MOCNAP "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/resources/mocnap.yml"
    click MOCNAPTONG "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/resources/mocnaptong.yml"
    click CPUI "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/gui/CardPriceUI.kt"
    click CTUI "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/gui/CardTypeUI.kt"
    click LOAITHYML "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/resources/menu/napthe/loaithe.yml"
    click MENHGIA "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/resources/menu/napthe/menhgia.yml"
    click CARD "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/card/Card.kt"
    click CARDPRICE "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/card/CardPrice.kt"
    click CARDRESULT "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/card/CardResult.kt"
    click CARDTYPE "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/card/CardType.kt"
    click CARDWAIT "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/card/CardWaiting.kt"
    click DAO "https://github.com/minevn/dotman/tree/master/dotman-plugin/src/main/java/net/minevn/dotman/database"
    click H2 "https://github.com/minevn/dotman/tree/master/dotman-plugin/src/main/java/net/minevn/dotman/database/h2"
    click MYSQL "https://github.com/minevn/dotman/tree/master/dotman-plugin/src/main/java/net/minevn/dotman/database/mysql"
    click MIGR "https://github.com/minevn/dotman/tree/master/dotman-plugin/src/main/resources/db/migrations"
    click CP "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/providers/CardProvider.kt"
    click GAMEBANK "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/providers/types/GameBankCP.kt"
    click THESIEU "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/providers/types/TheSieuTocCP.kt"
    click GAMEBANKYML "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/resources/providers/gamebank.yml"
    click THESIEUTOCYML "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/resources/providers/thesieutoc.yml"
    click BOSS "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/utils/BukkitBossBar.kt"
    click FMT "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/utils/FormatUtils.kt"
    click TOPUTIL "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/utils/TopUtils.kt"
    click UTILS "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/utils/Utils.kt"
    click DSC "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/java/net/minevn/dotman/config/Discord.kt"
    click DSC_CFG "https://github.com/minevn/dotman/blob/master/dotman-plugin/src/main/resources/discord.yml"
```
