# zapzombies/zombies architecture

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

- Interactive diagram: https://gitdiagram.com/zapzombies/zombies
- Repository: https://github.com/zapzombies/zombies

## Overview

##### And illustrate the main components
- Core Plugin Module – Represented by the classes in the “src” directory, with the main entry point (the “Zombies” class) that initializes the plugin and hooks into the Minecraft server lifecycle (via the plugin.yml configuration in resources).
- Command & Interaction Layer – This includes all command-related packages (under src/main/java/io/github/zap/zombies/command and its subpackages for game, map editor, etc.) that process user commands and delegate control to appropriate systems.
– Game Arena and State Management (classes like ZombiesArena, RoundContext, ZombiesArenaManager, etc.)
– Equipment & Power-Up Systems (both under equipment and equipment2 packages). These include gun mechanics, melee weapons, perks, and the logic associated with how they work in-game.
– Mob and NPC Behavior – Represented by packages for mobs, goals, injectors, and mechanics for events like attacking or spawning.
– Shops, Scoring, and Stats – Represent modules that handle in-game economy (shops and team machines) as well as scoreboard/state/GUI updates.
- NMS Bridge Layer – Since the plugin must work with different Minecraft versions, there’s a dedicated “nms” folder. This directory holds version-specific integration code (for example, under nms/nms-1_16_R3) and common abstractions (under nms/nms-common) that allow the core plugin logic to interact with Minecraft’s internal API.
- External Integration & Build/Deployment Tools – Include ancillary components (though not part of the runtime architecture) such as Gradle build scripts, GitHub workflows (for CI/CD), and Maven publishing configurations. These support the development lifecycle, environment setup, and deployment testing (like “Run development server”).

##### Relationships and interactions
- That the Command & Interaction Layer connects to the Game Mechanics & Logic components. Commands will trigger game events such as joining a game, editing maps, or triggering shop actions.
- Link the Equipment & Power-Up system to both the Game Mechanics and the Mob/NPC systems, emphasizing that equipment effects and power-ups influence game state, damage events, and scoring.
- That the Plugins’ event system (server events, player events) is integrated into many of these components (for example, tasks under game/player/task, mob goals, etc.).

##### Architectural patterns and technologies
- Modular design – The code is split cleanly into modules based on functionality. For example, game logic is separated from NMS-specific code.
- Use of dependency injection and abstraction – The “nms-common” module and the version-specific implementations (e.g., nms-1_16_R3) illustrate use of abstraction to support multiple game versions.
- Event-driven design – The plugin relies on Minecraft’s event system; many components (commands, tasks, mob mechanics) are invoked in response to events.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Core Plugin Module"
        CP["Core Plugin (Zombies.java)"]:::plugin
        CFG["Config (plugin.yml)"]:::config
    end

    subgraph "Command & Interaction Layer"
        CMD["Command Handler"]:::command
    end

    subgraph "Game Mechanics & Logic"
        ARA["Game Arena & State"]:::logic
        EQ1["Equipment (Traditional)"]:::logic
        EQ2["Equipment (Revised)"]:::logic
        MOB["Mob Mechanics & Goals"]:::logic
        NPC["NPC Integration"]:::logic
        SHOP["Shops"]:::logic
        SCR["Scoreboards"]:::logic
        STAT["Statistics"]:::logic
    end

    subgraph "NMS Bridge Layer"
        NMSV["NMS Bridge - Version 1_16_R3"]:::nms
        NMSC["NMS Bridge - Common"]:::nms
    end

    subgraph "External Integration & Build Tools"
        GRADLE["Gradle Build Tools"]:::build
        CICD["CI/CD Workflows"]:::build
    end

    CP -->|"registers"| CMD
    CMD -->|"triggers"| ARA
    ARA -->|"updates"| EQ1
    ARA -->|"updates"| EQ2
    ARA -->|"triggers"| MOB
    ARA -->|"triggers"| SHOP
    ARA -->|"updates"| SCR
    ARA -->|"updates"| STAT
    EQ1 -->|"affects"| MOB
    EQ2 -->|"affects"| MOB
    ARA -->|"calls"| NMSV
    EQ1 -->|"calls"| NMSV
    EQ2 -->|"calls"| NMSV
    MOB -->|"calls"| NMSV
    NPC -->|"calls"| NMSV
    ARA -->|"abstracts"| NMSC
    GRADLE ---|"builds"| CP
    CICD ---|"deploys"| CP

    click CP "https://github.com/zapzombies/zombies/blob/master/src/main/java/io/github/zap/zombies/Zombies.java"
    click CFG "https://github.com/zapzombies/zombies/blob/master/src/main/resources/plugin.yml"
    click CMD "https://github.com/zapzombies/zombies/tree/master/src/main/java/io/github/zap/zombies/command"
    click ARA "https://github.com/zapzombies/zombies/tree/master/src/main/java/io/github/zap/zombies/game"
    click EQ1 "https://github.com/zapzombies/zombies/tree/master/src/main/java/io/github/zap/zombies/game/data/equipment"
    click EQ2 "https://github.com/zapzombies/zombies/tree/master/src/main/java/io/github/zap/zombies/game/equipment2"
    click MOB "https://github.com/zapzombies/zombies/tree/master/src/main/java/io/github/zap/zombies/game/mob"
    click NPC "https://github.com/zapzombies/zombies/blob/master/src/main/java/io/github/zap/zombies/game/npc/ZombiesNPC.java"
    click SHOP "https://github.com/zapzombies/zombies/tree/master/src/main/java/io/github/zap/zombies/game/shop"
    click SCR "https://github.com/zapzombies/zombies/tree/master/src/main/java/io/github/zap/zombies/game/scoreboards"
    click STAT "https://github.com/zapzombies/zombies/tree/master/src/main/java/io/github/zap/zombies/stats"
    click NMSV "https://github.com/zapzombies/zombies/tree/master/nms/nms-1_16_R3/src/main/java/io/github/zap/zombies/nms/v1_16_R3"
    click NMSC "https://github.com/zapzombies/zombies/tree/master/nms/nms-common/src/main/java/io/github/zap/zombies/nms/common"
    click GRADLE "https://github.com/zapzombies/zombies/blob/master/build.gradle.kts"
    click CICD "https://github.com/zapzombies/zombies/tree/master/.github/workflows"

    classDef plugin fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef config fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef command fill:#FFA07A,stroke:#333,stroke-width:2px;
    classDef logic fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef nms fill:#FF6347,stroke:#333,stroke-width:2px;
    classDef build fill:#87CEFA,stroke:#333,stroke-width:2px;
```
