How alexcrea/disenchantment works
Main Components
• Plugin Core Module: Represent this as the central “Disenchantment Plugin” container.
• Subcomponents such as:
○ Commands Manager: This covers classes like CommandBuilder, CommandCompleter, CommandRegister, and the various command implementations (e.g., DisenchantEnchantments, DisenchantRepair, etc.).
○ Event Manager: Include custom events (e.g., DisenchantEvent, ShatterEvent, etc.) and their associated listeners (e.g., DisenchantListener, ShatterListener).
○ GUI Framework: List components handling the user interfaces such as GUI, GUIItem, InventoryBuilder, and specific GUI implementations (e.g., DisenchantmentRepairGUI, NavigationGUI).
○ Configuration & Localization: Include the Config, I18n classes, and migration steps. Also denote the config.yml and locale files in resources.
○ NMS (Native Minecraft Server) Compatibility Layer: Represent the NMS base and the version-specific implementations found within the “core” package and the separate version directories.
○ Plugin Integration: Represent the abstraction for supported plugins (like AdvancedEnchantments, EcoEnchants, etc.) that are handled through classes like ISupportedPlugin, SupportedPluginManager, and the concrete implementations in the version directories.
• Version-specific Modules: Because there are directories for v1_18_R1, v1_20_R4, and v1_21_R1, include a “Version Adapter/Bridge” component. This should illustrate:
• Version-specific NMS implementations (like NMS_v1_18_R1.java, NMS_v1_20_R4.java, etc.).
• The corresponding NBT handling classes for each version.
• The version-specific supported plugin wrappers (e.g., AdvancedEnchantments_v1_18_R1.java, etc.)
Relationships & Interactions
• For instance, commands issued from the user’s in-game actions go to the Commands Manager. Then these trigger events which are captured by the Event Manager, and from there, call into the GUI Framework or the core business logic.
• The Configuration component should be shown as feeding settings into various modules (commands, GUIs, and even NMS behaviors).
• The Plugin Integration components serve as a bridge between the core plugin functionality and external systems; these should be depicted as interacting with both the Commands/Event layers and the version-specific modules.
• That the NMS Compatibility Layer abstracts away differences between Minecraft versions by interacting with the version-specific implementations.
Architectural Patterns & Design Principles
• Modularity: The clear separation between core functionality and version-specific implementations is critical.
• Abstraction: Interfaces (e.g., ICommandExecutor, ICommandCompleter, IConfigMigration, and ISupportedPlugin) are used to decouple implementations from the core logic.
• Extensibility: By isolating integrations with external plugins and Minecraft’s internal (NMS) classes, the design makes it easier to add support for new versions or plugins.
Incorporate Relevant Technologies
• Java and Maven are the underlying technologies.
• The use of .yml configuration files for configuration and localization.
• Integration with external libraries (e.g., bStats for metrics and the jars in the version-specific “libs” directory).
• Detail the internal flow by connecting components that interact closely.