# boiscljo/sba architecture

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

- Interactive diagram: https://gitdiagram.com/boiscljo/sba
- Repository: https://github.com/boiscljo/sba

## Overview

##### Project type and purpose
- This is a multi-module Java project targeting the Spigot/Paper Minecraft server platform.
- It consists of two Gradle subprojects:
– api: a public Addon API offering interfaces, data classes, and custom event definitions so third-party addons can hook into the SBA (Survive BedWars Addon) system.
– plugin: the core SBA plugin implementation that brings the game mode to life by registering commands, listeners, services, game-loop tasks, and integrating with external plugins (e.g., Citizens, PlaceholderAPI, BungeeCord).

##### File structure
- Top-level modules
– api/: defines IConfigurator, AddonAPI, event classes, data holders, game interfaces (IArena, IParty, etc.), and language/permission abstractions.
– plugin/: the actual plugin code, organized by subpackages:
- commands/ – command handlers and CommandManager
- listener/ – Spigot event listeners
- game/ – Arena, GameStorage, Generator logic, and scheduled GameTaskManager
- service/ – services such as AIService, NPCStoreService, AntiCheatIntegration
- party/ – Party and PartyManager implementations
- config/ – SBAConfig and related configuration loaders
- special/ – special game mechanics (PopupTower, SpawnerProtection) and their runnables
- visual/ – scoreboard management (Lobby and Game scoreboards) using pronzelib
- fix/ – compatibility adapters for different server distributions (Magma, Mohist, ViaVersion, etc.)
- placeholderapi/ – SBAExpansion for PlaceholderAPI integration
- utils/ – various helpers (DateUtils, MessageUtils, SBAUtil)
– build scripts (build.gradle, settings.gradle) and CI workflows (.github/workflows)

##### README for additional insights
- (Empty in this snapshot)
- We infer from package names and class roles that the plugin orchestrates a BedWars-style minigame with parties, generators, upgrades, and in-game shops.

##### Detail
- External integration points (PlaceholderAPI, Citizens, BungeeCord, AntiCheat).
- Life cycle: plugin load → configuration → registration → game loop → shutdown.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Runtime and clients
    Player["Minecraft Client"]:::runtime
    Server["Spigot/Paper Server"]:::runtime

    Player -->|"connects"| Server

    %% Core modules loaded
    subgraph "Core Modules"
        direction TB
        API["Addon API (api.jar)"]:::core
        Plugin["SBA Plugin (plugin.jar)"]:::core
    end

    Server -->|"loads"| API
    Server -->|"loads"| Plugin
    Plugin -->|"depends on"| API
    Plugin -->|"depends on"| PronzeLib
    Plugin -->|"integrates"| ExternalPlugins

    %% Pronzelib external lib
    PronzeLib["pronzelib-scoreboards.jar"]:::external

    %% External plugins/services
    subgraph "External Integrations"
        direction TB
        Citizens["Citizens"]:::external
        PlaceholderAPIExt["PlaceholderAPI"]:::external
        BungeeCord["BungeeCord Proxy"]:::external
        AntiCheat["AntiCheat Plugin"]:::external
    end

    Plugin -->|"uses"| Citizens
    Plugin -->|"uses"| PlaceholderAPIExt
    Plugin -->|"uses"| BungeeCord
    Plugin -->|"uses"| AntiCheat

    %% API Module internals
    subgraph "API Module" 
        direction TB
        AddonAPI["Addon API Interfaces"]:::core
        IConfigurator["IConfigurator"]:::core
        Events["Custom SBA Events"]:::core
        GameData["Game Interfaces & Data Holders"]:::core
        APIManagers["API Managers"]:::core
    end

    API --> AddonAPI
    AddonAPI --> IConfigurator
    AddonAPI --> Events
    AddonAPI --> GameData
    AddonAPI --> APIManagers

    %% Plugin Module internals
    subgraph "Plugin Module"
        direction TB
        SBAEntry["Core Plugin Entry (SBA.java)"]:::core
        Commands["Command Subsystem"]:::service
        Listeners["Spigot Event Listeners"]:::service
        Services["Service Registry & Implementations"]:::service
        Managers["Managers & Task Schedulers"]:::service
        GameLogic["Game Domain Logic"]:::service
        Party["Party Management"]:::service
        Config["Configuration Loader"]:::service
        FixAdapters["Compatibility Adapters"]:::service
        PlaceholderAPI["PlaceholderAPI Expansion"]:::service
        Specials["Special Mechanics"]:::service
        Visuals["Visuals & Scoreboards"]:::service
        Utils["Utility Helpers"]:::service
        Inventories["Inventory/Shop UIs"]:::service
        Update["Update Checker"]:::service
    end

    Plugin --> SBAEntry
    SBAEntry --> Commands
    SBAEntry --> Listeners
    SBAEntry --> Services
    SBAEntry --> Managers
    SBAEntry --> GameLogic
    SBAEntry --> Party
    SBAEntry --> Config
    SBAEntry --> FixAdapters
    SBAEntry --> PlaceholderAPI
    SBAEntry --> Specials
    SBAEntry --> Visuals
    SBAEntry --> Utils
    SBAEntry --> Inventories
    SBAEntry --> Update

    %% Managers & tasks breakdown
    subgraph "Managers & Tasks"
        direction TB
        ArenaMgr["ArenaManager"]:::manager
        GameTaskMgr["GameTaskManager"]:::manager
        RotGen["RotatingGenerator"]:::manager
    end

    Managers --> ArenaMgr
    Managers --> GameTaskMgr
    GameTaskMgr --> RotGen

    %% Game domain breakdown
    subgraph "Game Domain"
        direction TB
        Arena["Arena"]:::process
        Storage["GameStorage"]:::process
    end

    GameLogic --> Arena
    GameLogic --> Storage

    %% Special mechanics breakdown
    subgraph "Special Mechanics"
        direction TB
        Popup["PopupTower"]:::process
        SpawnerProt["SpawnerProtection"]:::process
    end

    Specials --> Popup
    Specials --> SpawnerProt

    %% Click events
    click API "https://github.com/boiscljo/sba/tree/release/api/src/main/java/io/github/pronze/sba"
    click IConfigurator "https://github.com/boiscljo/sba/blob/release/api/src/main/java/io/github/pronze/sba/config/IConfigurator.java"
    click Events "https://github.com/boiscljo/sba/tree/release/api/src/main/java/io/github/pronze/sba/events"
    click GameData "https://github.com/boiscljo/sba/tree/release/api/src/main/java/io/github/pronze/sba/game"
    click GameData "https://github.com/boiscljo/sba/tree/release/api/src/main/java/io/github/pronze/sba/data"
    click APIManagers "https://github.com/boiscljo/sba/tree/release/api/src/main/java/io/github/pronze/sba/manager"
    click SBAEntry "https://github.com/boiscljo/sba/blob/release/plugin/src/main/java/io/github/pronze/sba/SBA.java"
    click Commands "https://github.com/boiscljo/sba/tree/release/plugin/src/main/java/io/github/pronze/sba/commands"
    click Listeners "https://github.com/boiscljo/sba/tree/release/plugin/src/main/java/io/github/pronze/sba/listener"
    click Arena "https://github.com/boiscljo/sba/blob/release/plugin/src/main/java/io/github/pronze/sba/game/Arena.java"
    click Storage "https://github.com/boiscljo/sba/blob/release/plugin/src/main/java/io/github/pronze/sba/game/GameStorage.java"
    click GameTaskMgr "https://github.com/boiscljo/sba/blob/release/plugin/src/main/java/io/github/pronze/sba/game/tasks/GameTaskManager.java"
    click Managers "https://github.com/boiscljo/sba/tree/release/plugin/src/main/java/io/github/pronze/sba/game/tasks"
    click Party "https://github.com/boiscljo/sba/blob/release/plugin/src/main/java/io/github/pronze/sba/party/PartyManager.java"
    click Config "https://github.com/boiscljo/sba/blob/release/plugin/src/main/java/io/github/pronze/sba/config/SBAConfig.java"
    click FixAdapters "https://github.com/boiscljo/sba/tree/release/plugin/src/main/java/io/github/pronze/sba/fix"
    click PlaceholderAPI "https://github.com/boiscljo/sba/blob/release/plugin/src/main/java/io/github/pronze/sba/placeholderapi/SBAExpansion.java"
    click Services "https://github.com/boiscljo/sba/tree/release/plugin/src/main/java/io/github/pronze/sba/service"
    click Specials "https://github.com/boiscljo/sba/tree/release/plugin/src/main/java/io/github/pronze/sba/specials"
    click Visuals "https://github.com/boiscljo/sba/tree/release/plugin/src/main/java/io/github/pronze/sba/visuals"
    click Utils "https://github.com/boiscljo/sba/tree/release/plugin/src/main/java/io/github/pronze/sba/utils"
    click Inventories "https://github.com/boiscljo/sba/tree/release/plugin/src/main/java/io/github/pronze/sba/inventories"
    click ArenaMgr "https://github.com/boiscljo/sba/blob/release/plugin/src/main/java/io/github/pronze/sba/game/ArenaManager.java"
    click RotGen "https://github.com/boiscljo/sba/blob/release/plugin/src/main/java/io/github/pronze/sba/game/RotatingGenerator.java"
    click Update "https://github.com/boiscljo/sba/blob/release/plugin/src/main/java/io/github/pronze/sba/UpdateChecker.java"

    classDef core fill:#D0E6FF,stroke:#0055BB
    classDef external fill:#DDF2DD,stroke:#228B22
    classDef runtime fill:#FFF4CC,stroke:#D4A017
    classDef service fill:#FFE6CC,stroke:#FF8C00
    classDef manager fill:#F0D0FF,stroke:#A020F0
    classDef process fill:#E6FFE6,stroke:#00AA00
```
