How playpro/coreprotect works
Main Components
• Plugin Core & Initialization
• Plugin Initialization Service (services/PluginInitializationService.java) and ShutdownService, VersionCheckService, etc.
• API Layer
• Public API classes (e.g., CoreProtectAPI.java) that expose logging and lookup functionalities to server administrators and potentially to other plugins.
• API modules like BlockAPI, QueueLookup, and SessionLookup.
• Command Handling
• That these modules accept player/server commands and route them to the appropriate functionality.
• Listener and Event Subsystem
• Listener packages (net/coreprotect/listener) which cover block, entity, player, and world listeners, plus any auxiliary inspector modules.
• Consumer / Processing System
• Asynchronous/logging processing components that consume events. This includes the consumer package and its various process classes (e.g., BlockBreakProcess, PlayerChatProcess, etc.).
• How events captured by listeners are handed off to the consumer for processing and then logged to the database.
• Database Module
• Database layer which handles persistence. This module (in net/coreprotect/database) contains classes for logging, lookups, rollbacks, and statement preparation.
• Separate subcomponents: Logger (with various logger classes), Lookup, Rollback, and Statement creation. Indicate interactions where processed data is written to, read from, or rolled back from the database.
• Integrations & Adapters
• Adapters for different Minecraft server implementations – groups for Bukkit (net/coreprotect/bukkit), Spigot (net/coreprotect/spigot), and Paper (net/coreprotect/paper).
• Plugin Channel integrations (under listener/channel) and any external communication paths.
• Configuration & Localization
• Configuration management modules (net/coreprotect/config) which load and handle configuration files.
• Language/translation support (the lang/ directory and net/coreprotect/language package) for localization.
• Utility & Common Libraries
• A supporting layer for various utilities (under net/coreprotect/utility) that provide functionalities like string processing, version utilities, database utilities, etc.
Relationships and Interactions
• Plugin Core initializes and interacts with API, Command Handlers, and Listener modules.
• Listeners capture events from the Minecraft server environment (via Bukkit/Spigot/Paper) and pass them to the Consumer.
• The Consumer processes these events and uses the Database module to log data.
• The API layer can offer read operations that may invoke lookups in the Database module, and rollback operations where needed.
• Configuration and Localization modules serve as dependencies that supply runtime configuration data and multi-language support to almost all components.
• Asynchronous communication within the Consumer to avoid blocking the main server thread.
Important Architectural Patterns & Design Principles
• Layered Architecture: Show clear segregation between presentation (event listeners, command handling), processing (consumer/queue handling), data access (database modules), and cross-cutting concerns (configuration, language, utilities).
• Adapter Pattern: Particularly in the integration with Bukkit, Spigot, and Paper – each adapter abstracts differences in Minecraft server implementations.
• Modular Design: Each package/subsystem (listeners, commands, database, processors) represents a dedicated module, promoting separation of concerns and maintainability.
Final Steps
• That every major function—from the reception of player commands or server events, through processing and logging, to data lookup and rollback—is represented.