How galaxy-vn/chemdah works
Project Type and Purpose
• Chemdah is clearly a plugin for a Minecraft server, integrating with platforms like Bukkit/Spigot.
• Its purpose is to handle complex features such as quest management, conversation systems, and support for various addons/modules (e.g., party systems, levels, realms, UI, wizard systems).
• The README indicates that the project needs to be built from source (using Gradle’s wrapper) with no pre-built jar provided. It also mentions available JavaDoc and related plugins like “Blockdb”, suggesting reliance on external data management utilities.
File Structure
• The top-level build files (build.gradle.kts, gradlew, settings.gradle.kts, etc.) indicate a typical Gradle-based Java/Kotlin project.
• There is both a Java and a Kotlin codebase; note that Java files (e.g., under src/main/java/ink/ptms/chemdah/library/redlib) form part of the reusable library (“redlib”) that handles core functions such as event listening, SQL integration, and backend support.
• The src/main/kotlin directory has the bulk of the development. The package structure (ink.ptms.chemdah) is divided into:
• API (exposing hooks and public events, found under …/chemdah/api and …/chemdah/api/event)
• Core (which contains engine components for conversation, database handling, and quest systems, as seen in the core directory)
• Modules (each module such as kether, level, party, realms, scenes, ui, wizard encapsulate distinct functionalities/extensions)
• Utility packages (providing extra functionality and helper classes)
• There is also a “resources” folder with configuration files (e.g., config.yml, various module and conversation configurations, and language files), indicating external configuration for runtime behavior.
Extract Key Architectural Elements
• Plugin Entry & Initialization:
• The entry point seems to be the Chemdah.kt file under src/main/kotlin/ink/ptms/chemdah. This is where the plugin likely initializes and registers events, modules, and API hooks.
• Core Engine Components:
• Conversation System – multiple packages under core/conversation including agents, triggers, and sessions.
• Quest Engine – a robust quest system with sub-packages for objectives (covering different kinds of game events like block interactions, entity damage, and custom event hooks) and selectors.
• Database Management – contained in core/database with support for SQL and SQLite; likely managing persistent data for quests and players.
• Library (Redlib):
• A lower-level utility library providing common functionalities for block data management, event handling, and backend implementations (including different backends such as PDCBackend and SQLiteBackend).
• Modular Extensions:
• Modules like kether (scripting/actions), level, party, realms, scenes, synchronous, UI, and wizard are encapsulated as independent components that integrate with the core engine.
• API and Event System:
• Exposed APIs and a comprehensive event system (in api/event) allow external plugins or addon developers to hook into Chemdah’s functionality.
• External Dependencies:
• Integration with external plugins (for example, the Blockdb jar, and integrations with Citizens, MythicMobs as observed in event trigger packages) is a key aspect of the design.
• Configuration Management:
• Extensive use of YAML configuration files (found in resources) that control conversation, module settings, and language resources.
1. Central “Plugin Entry Point (Chemdah.kt)” and branch out to show its immediate interactions:
• Core Engine touches: conversation, quest, database management.
• API Exposure: ChemdahAPI and event factories.
• Initialization of Modules.
• One for core functionalities (business logic, data persistence) that depend on the Redlib utilities.
• One for various modules (kether, level, party, etc.) that extend or specialize the core.
• One for configuration management, showing how YAML and other resource files feed into both Core and Modules.
3. Overlay external services and integrations: