How molocko/thesinnerbone works
Project Type and Purpose
• This is a Bukkit/Spigot (Minecraft) server plugin written in Java 17, named “TheSinnerBone.”
• Its purpose is to handle custom in-game events (“грех”) by listening to player actions (kills, respawns), running business logic, and persisting state in YAML files.
File-Structure Analysis
• Top-level Gradle build setup (build.gradle, gradlew, settings.gradle) indicates a single Java module.
• src/main/java/io/BM: contains the core code, split into:
• Main.java – plugin entrypoint (extends JavaPlugin)
• TSBCMD.java – command registration/handlers
• onPlayerKill.java, onPlayerRespawn.java – event listeners
• funcs.java, system.java – core business logic
• FileUtils.java – file I/O (config/data persistence)
• src/main/resources:
• plugin.yml – plugin metadata & command/event registration hooks
• config.yml – default configuration
Architecture Overview
Main components:
A. Minecraft Server (Spigot/Bukkit API)
B. Plugin Loader (Bukkit’s PluginManager)
C. Plugin Core
1. Main Class
2. Command Handlers (TSBCMD)
3. Event Listeners (onPlayerKill, onPlayerRespawn)
4. Business Logic (funcs, system)
5. FileUtils (YAML config & data store)
D. Storage (config.yml, custom data files)
Interaction flow:
1. Server startup → PluginManager loads Main → reads plugin.yml
2. Main.onEnable(): registers commands (TSBCMD) and events (listeners)
3. Player action triggers Bukkit event → onPlayerKill/onPlayerRespawn invoked
4. Listener calls system/funcs to apply game logic
5. FileUtils updates YAML storage as needed
6. Server returns event results to the client
Key Architectural Patterns & Principles
• Event-driven: uses Bukkit’s event bus for decoupled listener invocation.
• Command pattern: TSBCMD handles all user commands centrally.
• Single module plugin: all classes packaged together, loaded as one JAR.
• Separation of concerns: I/O (FileUtils), logic (system/funcs), API integration (Main/listeners).