# ggotha/skywars-plugin architecture

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

- Interactive diagram: https://gitdiagram.com/ggotha/skywars-plugin
- Repository: https://github.com/ggotha/skywars-plugin

## Overview

##### Main Components Identification

The system should be represented with these primary components:

a) Plugin Core (Rbac.java)
b) Command Handler System
c) Database Layer
d) Minigame Framework
e) Utility Services

##### Component Relationships

Use the following connection types:

##### Specific Implementation Details

a) Plugin Integration:
- How the plugin hooks into Spigot API
- Command registration flow

b) Minigame Framework:
- Inheritance structure from Minigame to SkywarsMinigame
- Lobby management system
- World generation/management components

c) Database Architecture:
- SQLite connection management
- Query flow
- Data persistence patterns

##### Key Interactions to Highlight

- Command processing flow
- Lobby creation and management
- Player session handling
- World generation and management
- Database operations

##### Utility Services

- Component types
- Special annotations

This structure will effectively communicate the plugin's architecture while maintaining clarity about the relationships between components and the flow of data/control through the system.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef command fill:#FDD835,stroke:#F9A825,color:black
    classDef database fill:#EF5350,stroke:#D32F2F,color:white
    classDef game fill:#66BB6A,stroke:#43A047,color:white
    classDef utility fill:#90A4AE,stroke:#546E7A,color:white
    classDef api fill:#CE93D8,stroke:#AB47BC,color:white

    %% Client Layer
    MC["Minecraft Server"]:::api
    SPIGOT["Spigot API"]:::api
    
    %% Core Plugin
    CORE["Plugin Core"]:::core
    click CORE "https://github.com/GGotha/skywars-plugin/blob/master/src/main/java/me/gotha/rbac/Rbac.java"

    %% Command System
    subgraph CommandSystem["Command Management"]
        CREATE["Create Command"]:::command
        FEAST["Feast Command"]:::command
        LEAVE["Leave Command"]:::command
        LOBBY["Lobby Command"]:::command
    end
    click CREATE "https://github.com/GGotha/skywars-plugin/blob/master/src/main/java/me/gotha/rbac/commands/CreateCommand.java"
    click FEAST "https://github.com/GGotha/skywars-plugin/blob/master/src/main/java/me/gotha/rbac/commands/FeastCommand.java"
    click LEAVE "https://github.com/GGotha/skywars-plugin/blob/master/src/main/java/me/gotha/rbac/commands/LeaveCommand.java"
    click LOBBY "https://github.com/GGotha/skywars-plugin/blob/master/src/main/java/me/gotha/rbac/commands/LobbyCommand.java"

    %% Game Logic Layer
    subgraph GameLogic["Minigame Framework"]
        MINIGAME["Abstract Minigame"]:::game
        SKYWARS["Skywars Minigame"]:::game
        LEVELS["Levels Management"]:::game
        LOBBY_PARAMS["Lobby Parameters"]:::game
        GAME_LOGIC["Game Logic"]:::game
    end
    click MINIGAME "https://github.com/GGotha/skywars-plugin/blob/master/src/main/java/me/gotha/rbac/minigames/Minigame.java"
    click SKYWARS "https://github.com/GGotha/skywars-plugin/blob/master/src/main/java/me/gotha/rbac/minigames/SkywarsMinigame.java"
    click LEVELS "https://github.com/GGotha/skywars-plugin/blob/master/src/main/java/me/gotha/rbac/minigames/Levels.java"
    click LOBBY_PARAMS "https://github.com/GGotha/skywars-plugin/blob/master/src/main/java/me/gotha/rbac/minigames/LobbyParameters.java"
    click GAME_LOGIC "https://github.com/GGotha/skywars-plugin/blob/master/src/main/java/me/gotha/rbac/minigames/Skywars.java"

    %% Database Layer
    subgraph Database["Database Layer"]
        SQLITE["SQLite Database"]:::database
        CONN["Connection Management"]:::database
        QUERIES["Database Queries"]:::database
        DB_INTERFACE["Database Interface"]:::database
        SCHEMA["Database Schema"]:::database
    end
    click CONN "https://github.com/GGotha/skywars-plugin/blob/master/src/main/java/me/gotha/rbac/database/SQLConnection.java"
    click QUERIES "https://github.com/GGotha/skywars-plugin/blob/master/src/main/java/me/gotha/rbac/database/Queries.java"
    click DB_INTERFACE "https://github.com/GGotha/skywars-plugin/blob/master/src/main/java/me/gotha/rbac/database/SkywarsDatabase.java"
    click SCHEMA "https://github.com/GGotha/skywars-plugin/blob/master/src/main/java/me/gotha/rbac/database/init.sql"

    %% Utility Services
    subgraph Utils["Utility Services"]
        POS_UTIL["Position Utility"]:::utility
        GEN_UTIL["General Utilities"]:::utility
    end
    click POS_UTIL "https://github.com/GGotha/skywars-plugin/blob/master/src/main/java/me/gotha/rbac/utils/MinecraftPosition.java"
    click GEN_UTIL "https://github.com/GGotha/skywars-plugin/blob/master/src/main/java/me/gotha/rbac/utils/Util.java"

    %% Relationships
    MC --> SPIGOT
    SPIGOT --> CORE
    CORE --> CommandSystem
    CORE --> GameLogic
    CORE --> Database
    CORE --> Utils

    CREATE & FEAST & LEAVE & LOBBY --> GAME_LOGIC
    MINIGAME --> SKYWARS
    SKYWARS --> LEVELS
    SKYWARS --> LOBBY_PARAMS
    GAME_LOGIC --> DB_INTERFACE
    DB_INTERFACE --> CONN
    CONN --> SQLITE
    DB_INTERFACE --> QUERIES
    QUERIES --> SCHEMA

    GAME_LOGIC --> POS_UTIL
    GAME_LOGIC --> GEN_UTIL

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Command Handlers"]:::command
        L3["Database Components"]:::database
        L4["Game Logic"]:::game
        L5["Utility Services"]:::utility
        L6["API Components"]:::api
    end
```
