How exceptedprism3/logger works
Project type and purpose
• This is an open-source, multi-module Java plugin suite (“Logger”) for Minecraft servers. It provides logging of in-game events (chat, commands, block actions, player activity, server stats) and can push logs to SQLite, external databases or Discord. There are three platform modules: BungeeCord proxy, Spigot (Bukkit) server, and Velocity proxy.
File structure
• Root module (pom.xml) aggregates sub-modules:
• Logger-BungeeCord (plugin for BungeeCord proxy)
• Logger-Spigot (plugin for Bukkit-based servers)
• Logger-Velocity (plugin for Velocity proxy)
• Logger-Shaded (builds an uber-jar with shaded dependencies)
• Each sub-module follows the same package layout:
– Main entry point (Logger.java)
– api (interfaces/adapters for external plugins: LiteBans, PartyAndFriends, etc.)
– commands (DiscordCMD, Reload, user commands)
– events (listeners for Chat, Login, Leave, server-side events, plug-independent events for other plugins)
– database (SQLite + “external” database support: ExternalData, ExternalUpdater)
– discord (Discord integration classes)
– serverside (internal commands: Start, Stop, RAM, Console)
– utils (ConfigManager, FileHandler, Messages, Metrics, ASCIIArt, UpdateChecker)
– resources (YAML config templates, messages, plugin.yml)
README for additional insights
• Describes features: logging various player/server events, supports MySQL (external DB) and SQLite, Discord integration, bStats metrics.
Main components
A. Platform Hosts (three parallel environments):
• BungeeCord Proxy
• Velocity Proxy
• Spigot/Bukkit Server
B. Plugin Loader & Initialization
• Reads YAML configs via ConfigManager
• Registers event listeners on the host’s event bus
• Initializes Metrics (bStats) and UpdateChecker
C. Event Manager
• OnEvent handlers (Chat, Command, Join, Leave, Death, BlockPlace, etc.)
• Plug-independent listeners (hook into other plugins via api adapters)
D. Command Manager
• In-game and console commands (Discord toggle, Reload, Dump, Stats commands)
E. Logging Engine & Data Model
• Data classes (Data, SQLiteData, ExternalData) represent events
• Repository/DAO layers (SQLite, ExternalUpdater) persist logs
F. Persistence Layer
• SQLite (embedded) via JDBC
• External DB support (MySQL) via ExternalUpdater
G. Discord Integration Layer
• Builds Discord messages (Discord, DiscordFile, DiscordStatus)
• Sends via Webhook/API
H. Utils & Supporting Services
• FileHandler (manages log files)
• ASCIIArt, Messages (presentation)
• UpdateChecker (self-update alerts)
Relationships and data flow
• Platform Host → PluginLoader
• PluginLoader → ConfigManager, Metrics, EventManager, CommandManager
• Event triggers on host → EventManager → LoggingEngine →
• Repository → SQLite or External DB
• DiscordLayer → Discord webhook
• Commands (in-game/console) → CommandManager → LoggingEngine or PluginLoader (reload)
• Utils invoked by all layers for I/O, messaging, metrics
Architectural patterns & design principles
• Modular multi-module Maven build for each platform
• Event-driven architecture consistent across modules
• Repository/DAO pattern for persistence
• Adapter pattern for external plugin integration (api package)
• Separation of concerns: init, events, commands, persistence, integration
Detail
• Subsystem (init, events, commands, DB, Discord, utils)
• Three platform targets as parallel lanes or separate modules
• Maven multi-module relationship if desired (root pom → child modules)