Conversation
…tance for improved flexibility
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the library to remove static dependencies on CorePlugin.getInstance() and adopt a dependency injection pattern by passing Plugin instances through constructors. The version is also updated from 1.3.0-SNAPSHOT to 1.3.2-SNAPSHOT, and build configuration has been modified to include shading for the reflections library.
- Refactored manager classes (
ConfigManager,FileManager), utility classes (MySQL), UI components (Menu), and integrations (DiscordApp) to acceptPlugininstances via constructor parameters - Created a new
Pluginclass extendingCorePluginto serve as the main plugin entry point - Updated build configuration to add shading functionality and removed Groovy-based version extraction
- Commented out the entire
WorldManagerclass for future migration to a dev tool
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| paper-plugin.yml | Updated main class reference from CorePlugin to Plugin and changed prefix from "Singularity" to "SingularityLib" |
| CorePlugin.java | Updated ConfigManager instantiations to pass this plugin instance and changed API version to hardcoded "1.3.0" |
| MySQL.java | Added Plugin parameter to constructor and updated all ConfigManager instantiations |
| Menu.java | Removed getInstance() import and replaced static calls with instance field |
| WorldManager.java | Commented out entire implementation with "WIP: Move to Dev tool" note |
| FileManager.java | Changed from static plugin instance to constructor-injected dependency |
| ConfigManager.java | Removed getInstance() dependency, added Plugin parameter to all constructors |
| DiscordApp.java | Added Plugin parameter to constructors for ConfigManager instantiation |
| Plugin.java | New class extending CorePlugin with basic startup/stop message implementations |
| pom.xml | Updated version to 1.3.2-SNAPSHOT, added maven-shade-plugin, removed Groovy plugin configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| } | ||
| } | ||
| // WIP: Move to Dev tool |
There was a problem hiding this comment.
[nitpick] Corrected spelling of 'Dev tool' to 'dev tool' for consistency with lowercase naming conventions.
| // WIP: Move to Dev tool | |
| // WIP: Move to dev tool |
| public ConfigManager(Plugin plugin, String fileName) { | ||
| this.plugin = plugin; |
There was a problem hiding this comment.
The constructor's Javadoc at line 24-27 does not document the newly added plugin parameter. The documentation should be updated to include @param plugin the plugin instance for accessing the data folder.
| public ConfigManager(Plugin plugin, String subFolder, String fileName) { | ||
| this.plugin = plugin; |
There was a problem hiding this comment.
The constructor's Javadoc at line 58-62 does not document the newly added plugin parameter. The documentation should be updated to include @param plugin the plugin instance for accessing the data folder.
| public final Plugin plugin; | ||
|
|
||
| /** | ||
| * Default constructor for FileManager. |
There was a problem hiding this comment.
The constructor's Javadoc at line 26-27 does not document the newly added plugin parameter. The documentation should be updated to include @param plugin the plugin instance for accessing the data folder.
| * Default constructor for FileManager. | |
| * Default constructor for FileManager. | |
| * | |
| * @param plugin the plugin instance for accessing the data folder |
| private Plugin plugin; | ||
|
|
||
| /** | ||
| * Default constructor for MySQL utility class. |
There was a problem hiding this comment.
The constructor's Javadoc at line 22-24 does not document the newly added plugin parameter. The documentation should be updated to include @param plugin the plugin instance for database operations.
| * Default constructor for MySQL utility class. | |
| * Constructs a MySQL utility class instance. | |
| * @param plugin the plugin instance for database operations |
| public DiscordApp(Plugin plugin, String configPath) { | ||
| this(plugin, configPath, false); |
There was a problem hiding this comment.
The constructor's Javadoc at line 32-35 does not document the newly added plugin parameter. The documentation should be updated to include @param plugin the plugin instance.
| public DiscordApp(Plugin plugin, String configPath, boolean multiThread) { | ||
| this.configPath = configPath; | ||
| configManager = new ConfigManager(configPath); | ||
| configManager = new ConfigManager(plugin, configPath); |
There was a problem hiding this comment.
The constructor's Javadoc at line 40-45 does not document the newly added plugin parameter. The documentation should be updated to include @param plugin the plugin instance.
| public static boolean isExists(Plugin plugin, String subFolder, String fileName) { | ||
| return new File(plugin.getDataFolder() + "/" + subFolder, fileName).exists(); |
There was a problem hiding this comment.
The method's Javadoc at line 46-52 does not document the newly added plugin parameter. The documentation should be updated to include @param plugin the plugin instance for accessing the data folder.
No description provided.