Injection is not possible with multiple constructors meaning the current implementation fails and isn't really necessary in this use case. Further, the current method will lead to countless https://github.com/google/guice/wiki/CAN_NOT_PROXY_CLASS errors as it requires a T type (plugin instance) which you can't directly reference staticly as that creates a circular dependency which can't be proxied when injecting.
I've changed the velocity manager here to allow direct instantiation rather than runtime injection. I've also removed one constructor from the sponge one (which has a similar problem) to fix the https://github.com/google/guice/wiki/TOO_MANY_CONSTRUCTORS that occurs with that.
Here's how you get a VelocityLibraryManager now:
VelocityLibraryManager<VelocityPlugin> manager = new VelocityLibraryManager<>(logger, dataDirectory, getProxyServer().getPluginManager(), getInstance(), "lib");
where
logger -> your SL4J instance
dataDirectory -> your @DataDirectory already retrievable through injection
VelocityPlugin -> your velocity plugin
Injection is not possible with multiple constructors meaning the current implementation fails and isn't really necessary in this use case. Further, the current method will lead to countless https://github.com/google/guice/wiki/CAN_NOT_PROXY_CLASS errors as it requires a T type (plugin instance) which you can't directly reference staticly as that creates a circular dependency which can't be proxied when injecting.
I've changed the velocity manager here to allow direct instantiation rather than runtime injection. I've also removed one constructor from the sponge one (which has a similar problem) to fix the https://github.com/google/guice/wiki/TOO_MANY_CONSTRUCTORS that occurs with that.
Here's how you get a VelocityLibraryManager now:
where
logger
-> your SL4J instancedataDirectory
-> your@DataDirectory
already retrievable through injectionVelocityPlugin
-> your velocity plugin