As a way to clean up my code and focus more on my intended algorithms vs all the overhead needed to set up a plugin, I tried placing all the @Inject modifiers in an abstract superclass. Since I also have a suite of plugins I’m developing, I decided to have each plugin’s main class implement a standardized interface, and extend this abstract ‘plugin’ class. However it seems like this causes sponge/Forge to freak out:
I also tried making two separate but identical abstract classes instead, having each plugin’s main class implement the following interface and the following abstract class:
Basically my aim here is to make the main class more human readable. So my question is, can I do what I’m trying to do? or is there something specific to @Inject/Guava that makes this a fruitless endeavor?
I do this for KatLib and related plugins through a constructor annotated with @Inject, and then pass the objects on to the super class. Not sure if it’s exactly what you need, but it’s a thing.
Do be careful about extending classes for the main plugin though. If the abstract plugin class is in another jar from the implementation it might fail to load if the jar with the abstract plugin class hasn’t been loaded yet. This is AFAIK only a problem with SpongeForge, not SpongeVanilla.