Getting a head start on my plugins. Built the API jar. Uh, now what..?

I downloaded the source to the API and built it no problem, added it to the build path of an empty maven project that will be my plugin. All good. Now with Bukkit, I would just set up a main class implementing JavaPlugin, add onEnable() and then the wheels are rolling. But, after finding a literal no information in the readme about what to do after building the API, I am stuck. What exactly do I do to make my project, well, a Sponge plugin? Or is this not even laid out yet…

I don’t want to sound needy or impatient, I just want to be proactive, and I can’t seem to find an answer.

Wait until there is an actual release to build against.

Well, just one thing in advance: Sponge doesn’t have onEnable/Disable. You must have a main pluggin class annotated with @Plugin (I think) and you need to have event handlers in there.


@Plugin(id = "youruniquepluginid", name = "SuperAwesomePlugin", version = "1.0")
public class SuperAwesomePluginMain {

Now, you have your basic plugin class. But you need an entry and an exit point right? There are several events that you can subscribe to for this purpose. You can see them here:

Let's call the method onEnable, because thats probably what you're most comfortable with, coming from bukkit.
First thing to note is that sponge event handlers define the events they handle by the parameter type. They are marked as event handlers by the @SpongeEventHandler annotation. */

    public void onEnable(PreInitializationEvent event) {
        //TODO: Read data, get yourself set up...

//Same here...
    public void onDisable(ServerStoppingEvent event) {
        //TODO: Cleanups, save your data, etc...

You can register as many even handlers as you like for all the events you need.

Hope that helped

~ TBot

1 Like

Coming from Bukkit I knew there had to be an entry and exit point of some sort. So its like a forge mod, but instead of “mod” its “plugin”. Simple enough. This is all I needed to know, thanks!

1 Like

Thanks for the question, will help me in the future when I start coding!