# destrutor2/destructor2lit architecture

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

- Interactive diagram: https://gitdiagram.com/destrutor2/destructor2lit
- Repository: https://github.com/destrutor2/destructor2lit

## Overview

##### Project Type and Purpose
- The project is a Minecraft plugin specifically for Bedwars functionality. It integrates with Minecraft’s server (likely Spigot or other server APIs) through custom events, commands, and entity management.
- The README and code comments (even though in French) confirm that this is the author’s first Java project for a Bedwars game mode. The intended audience is likely server owners and developers who may extend or finish the plugin.

##### Analyzing the File Structure
- Top-Level Structure:
- The “src/main/java” directory contains all the Java source code.
- There is an “Archives” folder that appears to contain legacy or experimental files (with classes like BwConfig.kt, BwPlayer.java, BwTeam.java, etc.).
- The main package is “com/destructor/destructor2lit,” which further divides into several subpackages according to functionality.
- Key Subpackages and Their Roles:
- API: Contains event interfaces and APIs (e.g., BwKillEvent) for integration or callback mechanisms.
- commands: Contains classes handling player commands (bedwarsCommand, toggleparticulesCommand) – connecting user actions to plugin logic.
- customEffects, customEntities, customItems: These represent the extension of Minecraft’s native entities and effects, enabling custom game mechanics.
- enums: Defines constants and types such as game phases, item types, and upgrade types, which are central to controlling game logic.
- events: Handles in-game events (e.g., BedBreak, Die) which then trigger other processes in the plugin, following an event-driven design.
- gens: Likely implements game resource generators (both team and regular variants).
- guis: Manages in-game interfaces and menus (shops, upgrade screens, etc.) needed for player interaction.
- listeners: Contains code responding to Minecraft server or plugin-specific events (e.g., player joins, NPC clicks, world events).
- managers: Central orchestration components that could be in charge of non-trivial tasks such as NPC management.
- timers: Implements scheduled tasks like the game phase countdown or spawn protection timers, indicating a time driven state machine approach.
- utils and packetWrappers: Provide reusable utility functions and low-level wrappers for communication with Minecraft’s networking layer, respectively.
- Resources:
- The “src/main/resources” includes configuration files (config.yml) and a plugin descriptor (plugin.yml) that registers the plugin with the server.

To accurately represent the project’s architecture, you need to divide the system into several logical components. Here’s what to include:

a. Main Components:
- Plugin Core/Entry Point: Represented by the “Main.java” class, this is where the plugin initializes, registers events, commands, and loads configurations.
- Command Module: The “commands” package handles player initiated commands. A node should represent this component showing how it interacts with the Plugin Core.
- Game State & Logic: The “enums,” “gens,” “timers,” and “managers” collectively manage game states (phases, scoreboards) and game logic. Create a node grouping these together.
- User Interface Module: The “guis” package represents in-game menus and interface elements.
- Utility and Communication Module: The “utils” and “packetWrappers” showcase low-level operations, reflection, and communication with the Minecraft networking layer.

b. Relationships and Interactions:
- Plugin Core interacts with all modules by initializing and coordinating them.
- The Command Module sends requests to the Game State & Logic module, triggering game events that the Event Module handles.
- Event Listeners capture events (triggered externally by the Minecraft server) and invoke custom responses (e.g., spawn entities, update GUIs).
- Custom Entities/Effects utilize utility classes and packet wrappers for network-level communications (e.g., rendering effects for clients).
- Timers and managers ensure that game phases and events run in a scheduled manner.
- Configuration files (config.yml, plugin.yml) feed into the Plugin Core for parameterization and module behavior.

c. Architectural Patterns & Design Principles:
- Event-Driven Architecture: The plugin largely depends on events (commands, game events, timer callbacks) that drive state changes.
- Modular Design: Each package (commands, events, timers, etc.) encapsulates a distinct responsibility, making it easier to extend or maintain.
- Use of Utility/Abstraction Layers: The “utils” and “packetWrappers” provide abstraction over lower-level operations, enhancing modularity.

d. Technologies & Frameworks:
- Java (as the primary language).
- Maven for project management/build (pom.xml present).
- Likely integration with Spigot/Bukkit APIs for Minecraft server communication (as seen by “plugin.yml” and references to Minecraft-like events and commands).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Entities
    P["Minecraft Server"]:::external

    %% Core Component
    A["Plugin Core (Main)"]:::core

    %% Command Module
    B["Command Module"]:::command

    %% Event Modules
    C["Events"]:::event
    D["Listeners"]:::event

    %% Custom Components Subgraph
    subgraph "Custom Components"
        E["Custom Entities"]:::custom
        F["Custom Effects"]:::custom
        G["Custom Items"]:::custom
    end

    %% Game State & Logic Subgraph
    subgraph "Game State & Logic"
        H["Enums"]:::logic
        I["Generators"]:::logic
        J["Timers"]:::logic
        K["Managers"]:::logic
    end

    %% User Interface Module
    L["User Interface Module"]:::ui

    %% Utility & Communication Subgraph
    subgraph "Utility & Communication"
        M["Utilities"]:::util
        N["Packet Wrappers"]:::util
    end

    %% Configuration
    O["Configuration"]:::config

    %% Relationships and Interactions
    %% Plugin Core interactions
    A -->|"registers"| B
    A -->|"registers"| C
    A -->|"registers"| D
    O -->|"loads"| A

    %% Commands and Events affecting Game State
    B -->|"triggers"| H
    C -->|"triggers"| H
    D -->|"updates"| H

    %% Game State updating UI
    J -->|"updates"| L
    K -->|"updates"| L

    %% Custom Components utilizing utilities for network operations
    E -->|"uses"| M
    F -->|"uses"| M
    G -->|"uses"| M

    E -->|"communicates"| N
    F -->|"communicates"| N
    G -->|"communicates"| N

    %% Minecraft server interactions with Event Listeners
    P -->|"sendsEvents"| D
    D -->|"invokesResponse"| A

    %% Define Colors and Styles
    classDef core fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef command fill:#87cefa,stroke:#000,stroke-width:2px;
    classDef event fill:#90ee90,stroke:#000,stroke-width:2px;
    classDef custom fill:#ffa07a,stroke:#000,stroke-width:2px;
    classDef logic fill:#ffdab9,stroke:#000,stroke-width:2px;
    classDef ui fill:#ffb6c1,stroke:#000,stroke-width:2px;
    classDef util fill:#dda0dd,stroke:#000,stroke-width:2px;
    classDef config fill:#f0e68c,stroke:#000,stroke-width:2px;
    classDef external fill:#d3d3d3,stroke:#000,stroke-width:2px;

    %% Click Events
    click A "https://github.com/destrutor2/destructor2lit/blob/main/src/main/java/com/destructor/destructor2lit/Main.java"
    click B "https://github.com/destrutor2/destructor2lit/tree/main/src/main/java/com/destructor/destructor2lit/commands"
    click C "https://github.com/destrutor2/destructor2lit/tree/main/src/main/java/com/destructor/destructor2lit/events"
    click D "https://github.com/destrutor2/destructor2lit/tree/main/src/main/java/com/destructor/destructor2lit/listeners"
    click E "https://github.com/destrutor2/destructor2lit/tree/main/src/main/java/com/destructor/destructor2lit/customEntities"
    click F "https://github.com/destrutor2/destructor2lit/tree/main/src/main/java/com/destructor/destructor2lit/customEffects"
    click G "https://github.com/destrutor2/destructor2lit/tree/main/src/main/java/com/destructor/destructor2lit/customItems"
    click H "https://github.com/destrutor2/destructor2lit/tree/main/src/main/java/com/destructor/destructor2lit/enums"
    click I "https://github.com/destrutor2/destructor2lit/tree/main/src/main/java/com/destructor/destructor2lit/gens"
    click J "https://github.com/destrutor2/destructor2lit/tree/main/src/main/java/com/destructor/destructor2lit/timers"
    click K "https://github.com/destrutor2/destructor2lit/tree/main/src/main/java/com/destructor/destructor2lit/managers"
    click L "https://github.com/destrutor2/destructor2lit/tree/main/src/main/java/com/destructor/destructor2lit/guis"
    click M "https://github.com/destrutor2/destructor2lit/tree/main/src/main/java/com/destructor/destructor2lit/utils"
    click N "https://github.com/destrutor2/destructor2lit/tree/main/src/main/java/com/destructor/destructor2lit/utils/packetWrappers"
    click O "https://github.com/destrutor2/destructor2lit/tree/main/src/main/resources"
```
