# jaimss/moducore architecture

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

- Interactive diagram: https://gitdiagram.com/jaimss/moducore
- Repository: https://github.com/jaimss/moducore

## Overview

Based on our review of the file tree and README, this project is a modular Minecraft server plugin (ModuCore) that provides a core API as well as several integrations – most notably with Bukkit/Spigot for in-game functionality and Discord for external interaction. It is clearly built to be highly configurable and modular, with a separate module for shared/common code, one for the API (core functions and events), one for the Bukkit implementation (commands, listeners, GUI, metrics, etc.), and one for Discord (bot commands, configuration, integrations).

##### Major Components
- API Module: Contains the main core functions for ModuCore. It defines data classes (like Kit, LocationHolder, and PlayerData), events (chat, teleport, economy events, etc.), and the developer-facing API.
- Bukkit Module: Implements the plugin for the Minecraft server. Here you have commands (for managing kits, teleportation, chat, and more), event listeners, configuration, and managerial functions (such as economy, kit, location, and player management) that link directly to the Bukkit server.
- Common Module: Contains shared utility code, common constants, functions, messaging, and tests. It helps ensure code reuse throughout the project.
- Discord Module: Provides Discord bot functionality. It manages Discord-related commands, integrations, bot configuration, and cross-service communication that link the Minecraft server to Discord channels.
- Build/Deployment & Assets: Gradle build files, assets (such as images and configuration files), and CI/CD integration (as shown in the .github and gradle directories).

##### Relationships and Interactions
- The Common module is a shared library that supports functionality across other modules. Represent it as a central component linked (or “used by”) all other modules.
- The Bukkit module interacts with the Minecraft server environment (commands, events, listeners, GUIs) and integrates with external libraries (e.g., bStats and PlaceholderAPI). Indicate external connections for these integrations.
- The Discord module interacts with the external Discord service via its API. It pulls information from or pushes events to the API module to keep the two in sync.
- These modules may also communicate with each other either directly (e.g., common utility functions, shared managers) or indirectly via the API layer.

##### Architectural Patterns and Design Principles
- Modularity: Clearly indicate that features (modules) can be enabled or disabled “on the fly” without a restart. This decoupling should be reflected by distinct component boundaries.
- Manager/Facade Pattern: The presence of various managers (for player, kit, location, economy, etc.) within both the API and Bukkit modules suggests a pattern where each feature is encapsulated behind a facade for simplified interaction.
- Build & Integration: Although not a runtime component, note that Gradle and CI/CD workflows shown in the file tree support continuous integration and modular building.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Core Modules"
        API["ModuCore API"]:::api
        BUKKIT["Bukkit Plugin"]:::bukkit
        DISCORD["Discord Bot"]:::discord
        COMMON["Common Utilities"]:::common
    end

    subgraph "External Services"
        MINECRAFT["Minecraft Server Environment"]:::external
        DISCORD_SVC["Discord Service"]:::external
    end

    subgraph "Build & Deployment"
        BUILD["Build & CI/CD Infrastructure"]:::build
    end

    %% Module Dependencies
    BUKKIT -->|"uses"| API
    DISCORD -->|"uses"| API
    API -->|"supports"| COMMON
    BUKKIT -->|"uses"| COMMON
    DISCORD -->|"uses"| COMMON

    %% External Integrations
    BUKKIT -->|"integrates"| MINECRAFT
    DISCORD -->|"integrates"| DISCORD_SVC

    %% Build/Deployment builds all modules
    BUILD -->|"builds"| API
    BUILD -->|"builds"| BUKKIT
    BUILD -->|"builds"| DISCORD
    BUILD -->|"builds"| COMMON

    %% Event-driven interactions
    API -->|"publishes-events"| BUKKIT
    API -->|"publishes-events"| DISCORD

    %% Click Events for Component Mapping
    click API "https://github.com/jaimss/moducore/tree/master/api/src/main/kotlin/dev/jaims/moducore/api"
    click BUKKIT "https://github.com/jaimss/moducore/tree/master/bukkit/src/main/kotlin/dev/jaims/moducore/bukkit"
    click COMMON "https://github.com/jaimss/moducore/tree/master/common/src/main/kotlin/dev/jaims/moducore/common"
    click DISCORD "https://github.com/jaimss/moducore/tree/master/discord/src/main/kotlin/dev/jaims/moducore/discord"
    click BUILD "https://github.com/jaimss/moducore/tree/master/gradle/"

    %% Styles
    classDef api fill:#fceabb,stroke:#e09b7d,stroke-width:2px;
    classDef bukkit fill:#bbdefb,stroke:#90caf9,stroke-width:2px;
    classDef discord fill:#c8e6c9,stroke:#81c784,stroke-width:2px;
    classDef common fill:#fff9c4,stroke:#fff176,stroke-width:2px;
    classDef external fill:#ef9a9a,stroke:#e57373,stroke-width:2px;
    classDef build fill:#d1c4e9,stroke:#b39ddb,stroke-width:2px;
```
