So I’ve been working on this for about 5 hours. I’ve tried different builds of the Sponge Server as well as the Forge server when trying to run my test server. I built a simple plugin and for whatever reason, it will say the “mod” is loaded, but none of my code seems to run.
I’ve tried using the built in logger, a custom logger and even System.out and none of them seem to print anything to the console.
I tried a few different plugins to see if they would work, and they did. So I then looked at the code of those plugins and implemented it into my own, replacing the code I had. Still, I had nothing.
This is what I have now:
@Plugin(id = "ServerControl", name = "ServerControl", version = "1.0-DEV")
public class ServerControl {
private org.slf4j.Logger logger;
@Inject
public void setLogger(org.slf4j.Logger logger) {
this.logger = logger;
}
@Subscribe
public void onServerStart(ServerStartedEvent event) {
//log.setupLogger(logger);
logger.info("Working");
//log.info("Initialized ServerControl");
}
}
Keep in mind that many events are current unimplemented. It’s entirely possible that that’s the cause of this issue, as has been posted in nearly every resource available.
I tried that, and it didn’t work. I’m so confused. It works for other people, but not for me. I can usually figure this stuff out on my own, but 5 hours of modifications and research didn’t do the trick
It is. I’m so lost. Is there maybe some other information I could give you? Like the artifacts or something?
EDIT: I just tried creating a plugin using Eclipse instead of Intellij, and this time Forge realized it was a non-mod file. When creating and building the plugin in Intellij it marks it as a mod file.
Sponge Build: 1.8-1371-2.1DEV-433
Forge Build: 11.14.1.1397
I don’t have it installed in my client I was just testing by starting up the server.
I don’t have any other plugins or mods installed
I’m using JRE 1.8_20 or something like that
I’m using Windows 8.1
I feel like I have narrowed it down to the way I’m building it, because other plugins work just fine, none of mine, even when building with another IDE it doesn’t work.
Alright, the first thing I notice is you are targetting a very old version of SpongeAPI in your pom file, you should be targetting at least version 2.0.
The impact this version upgrade has on your code is that the Subscribe annotation was moved from util.event to just the event package. Once that is fixed and I run the server I see the message as I would expect.
[17:26:28] [Server thread/INFO] [ServerControl]: Working
When I put 2.0 in there it returns an error (I only just started using Maven, I never used to like it because I never understood it, so I’m just now giving it a chance).
EDIT: well dang. Now I just feel like a darn fool that fixed it. What’s the latest version I can target?