# felixkraas/fasttravelreborn architecture

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

- Interactive diagram: https://gitdiagram.com/felixkraas/fasttravelreborn
- Repository: https://github.com/felixkraas/fasttravelreborn

## Overview

##### Main Components
- Core Plugin Module: The heart of the plugin is represented by the main class (FastTravel.java) that initializes the plugin and registers the various components.
- Commands Module: All command classes (e.g., FastTravelCommand, AutoCommand, DeleteCommand, etc.) which respond to player commands.
- Event Listener Module: Multiple listeners for handling in-game events such as block events, entity events, sign events, and more (e.g., FTBlockListener, FTPlayerListener, FTSignListener, etc.). These capture and respond to Bukkit’s event system.
- Data/Database Module: There is a clear abstraction for data persistence with classes for different DB types (MySQL, SQLite, FileDB) along with their respective handlers (FileDBHandler, SQLDBHandler) and representations (FastTravelDB, FastTravelSign). This module handles saving and retrieving teleportation sign data and settings.
- I/O and Localization Module: Managed by IOManager, Translator, and language-specific files (LangEN) that define messaging, language phrases, etc.
- Menu and UI Module: The SignMenu class indicates there is a user interface component (likely a custom in-game menu for fast travel options).
- Task Scheduling Module: Task classes (e.g., CheckPlayerTask, TravelTask, WarmupPlayerTask) that handle timed or asynchronous operations as part of the teleportation process.
- Third-Party Integration: Includes hooks (e.g., DynmapHook, PluginHook) for integrating with other plugins or services (such as external maps or server tools).

##### Relationships and Data Flow
- At startup, the Core Plugin (FastTravel.java) initializes and registers command handlers, event listeners, and tasks with the Bukkit server.
- When players interact with the game (e.g., issuing commands or triggering events), the corresponding Command classes or Listener classes are invoked.
- Listener classes then interact with the Data Module to check, update, or fetch teleportation data. For example, a sign being activated might trigger an event that consults the database layer.
- The I/O Module supports these actions by handling file-based configurations, localization, and language translation.
- Task components are scheduled by the core plugin to handle operations like warmups or monitoring the state of players and their travel, and these tasks might again interact with the database or update UI elements like the SignMenu.
- Third-party integrations hook into this flow to modify or extend behaviors if other plugins are present.

##### Architectural Patterns and Design Principles
- Plugin Modularization: The clear separation into commands, listeners, data, I/O, and tasks follows a modular design where each module handles a specific responsibility.
- Event-Driven Architecture: Heavily based on event listeners and hooks that respond to the Bukkit API’s event system.
- Abstraction of Data Access: The data package abstracts different database types (file-based, SQL-based) to make plugin configuration and persistence flexible.
- Extensibility: The use of third-party hooks and a separate language module emphasizes support for extensibility and customization.

##### Final Touches
- Annotations if needed to explain the purpose of specific interactions (e.g., “Translates in-game messages using Translator after an event”).

## Diagram (Mermaid)

```mermaid
flowchart TD
    Core("Core Plugin (FastTravel.java)"):::plugin
    Cmd("Commands Module"):::module
    List("Event Listener Module"):::module
    Task("Task Scheduling Module"):::module
    IO("I/O & Localization Module"):::module
    Lang("Localization Files (LangEN)"):::localization
    Data("Data/Database Module"):::module
    Menu("Menu and UI Module"):::module
    Third("Third-Party Integration"):::module

    %% Initialization from Core Plugin
    Core -->|"registersCommands"| Cmd
    Core -->|"registersListeners"| List
    Core -->|"schedulesTasks"| Task
    Core -->|"loadsConfig"| IO
    Core -->|"integratesThirdParty"| Third

    %% Module interactions
    Cmd -->|"dataAccess"| Data
    List -->|"triggersDataOps"| Data
    Task -->|"checksData"| Data
    Task -->|"updatesUI"| Menu
    List -->|"hooksIntoPlugins"| Third
    Cmd -->|"usesTranslation"| IO
    List -->|"usesTranslation"| IO

    %% I/O and Localization internal relationship
    IO --> Lang

    click Core "https://github.com/felixkraas/fasttravelreborn/blob/master/src/main/java/de/germanspacebuild/plugins/fasttravel/FastTravel.java"
    click Cmd "https://github.com/felixkraas/fasttravelreborn/tree/master/src/main/java/de/germanspacebuild/plugins/fasttravel/commands"
    click List "https://github.com/felixkraas/fasttravelreborn/tree/master/src/main/java/de/germanspacebuild/plugins/fasttravel/Listener"
    click Data "https://github.com/felixkraas/fasttravelreborn/tree/master/src/main/java/de/germanspacebuild/plugins/fasttravel/data"
    click IO "https://github.com/felixkraas/fasttravelreborn/tree/master/src/main/java/de/germanspacebuild/plugins/fasttravel/io"
    click Lang "https://github.com/felixkraas/fasttravelreborn/tree/master/src/main/java/de/germanspacebuild/plugins/fasttravel/io/language"
    click Menu "https://github.com/felixkraas/fasttravelreborn/blob/master/src/main/java/de/germanspacebuild/plugins/fasttravel/menu/SignMenu.java"
    click Task "https://github.com/felixkraas/fasttravelreborn/tree/master/src/main/java/de/germanspacebuild/plugins/fasttravel/task"
    click Third "https://github.com/felixkraas/fasttravelreborn/tree/master/src/main/java/de/germanspacebuild/plugins/fasttravel/thirdparty"

    classDef plugin fill:#FFD700,stroke:#333,stroke-width:2px,color:#000;
    classDef module fill:#87CEFA,stroke:#333,stroke-width:2px,color:#000;
    classDef localization fill:#FFA07A,stroke:#333,stroke-width:2px,color:#000;
```
