The Dummy class in the root of the source code folder is out of place. There is a good reason for it to exist (unless I'm wrong about its purpose), but is very unclear to new developers why it is needed at all.
CivModCore is more or less a utilities library for Civcraft plugins. Since it is a library and not a plugin, a plugin class for this project is not necessarily needed for it to work. However, none of the other plugins using it will be able to access it unless it is part of the runtime classpath. There are several ways to achieve this, but taking advantage of Spigot's loading of plugins by adding a plugin class to CivModCore is perhaps the easiest and most elegant.
Unfortunately, there is nothing to document that this is the reason for Dummy and so its purpose remains unclear to most. (Also, side note, since the plugin class is only used to have Spigot load the files, extending Dummy from ACivMod is completely unnecessary, JavaPlugin would be more ideal).
This could be quickly solved by adding a comment to the class, but some minor issues still remain:
- It's ugly. There really shouldn't be any classes in the project root, it's looks bad and in very very rare cases can cause issues.
- All plugins that use CivModCore have access to the Dummy class. This isn't likely to be a problem, but it's still an indication of poor design.
I propose the following change: separate the project into two modules, such as civmodcore and civmodcore-plugin. In the civmodcore module goes all of the current code minus the Dummy class. In the civmodcore-plugin module goes the Dummy class, ideally renamed and put into the vg.civcraft.mc.civmodcore
package instead of the root. The civmodcore-plugin jar would have everything from the civmodcore module shaded into it.
The civmodcore-plugin module is what the server would run while all the plugins would use the civmodcore module as a dependency.
Documentation about the purpose of the civmodcore-plugin module can be added and any plugins using CivModCore never even know that the Dummy class exists.
This is a minor issue, but fixing it is simple and should slightly improve the structure of the project.
Thoughts? Am I just thinking too hard about this?