[OUTDATED] Sponge Plugin Coding For Dummies

(Moderation Edit) ** PLEASE NOTE: **

This guide is no longer updated and therefore lacking new information plus may contain (now) false information. Please head over to the SpongeDocs to get the latest information including updates.

When I was into Bukkit, I wrote a Google Doc called Bukkit Coding For Dummies. Since I’m not trying to step away from Bukkit to move to Sponge, I’ve starting creating a new Google Doc called Sponge Coding For Dummies. My aim is to allow anybody, no matter their experience, to learn how to create plugins for Sponge.

As there’s no way (as far as I know) to run Sponge, non of the code can be tested. If I’m doing something, or say something incorrectly, please let me know so I can make the required fixes. Also, if I’m unclear in explaining anything, I’d appreciate if you could give me some feedback on how to be more clear.

Also, to all of you Bukkit plugin developers out there, I’ve included some comments to help you make the transition. I have a feeling these will be pretty helpful to you :wink:

Lastly, this is being worked on all of the time, so parts may be incomplete. Since Sponge hasn’t even been released yet, a lot is going to change. Please bare with me.

Any and all feedback is much appriciated. Once Sponge is released, and in a semi-stable state, I’ll do my best to release videos side-by-side with this Google Doc. Also, I’d love if you guys could share this with your friends once Sponge is released :slight_smile:

13 Likes

This has already been done before although I gotta say this is really good. If you still want to view the other topic here’s a link.

Thanks for the feedback! My main goal in creating this, is to allow anybody, no matter their experience, learn how to create plugins for Sponge. I’m hoping to add tons more as well! Creating plugins through Bukkit is the main way I’ve learned much about programming, and I’m hoping to teach others in a similar way. The added comments for Bukkit coders is just a little extra to help Bukkit coders port their plugins.

You’ve over-complicated the IDE setup. After running a gradlew build, to setup a workspace simply type gradlew eclipse for eclipse, gradlew idea for Intelij IDEA, etcetera. No need for any project setup, buildpath etc.
Oh and please suggest people use git if they have it.

1 Like

I personally think the way I currently have the IDE setup makes the most sense (again, imo). Once the API is released as a JAR (assuming it will be), it’ll be imported the same way as I’m showing now. Also, this way works for every IDE, so in the future, it’d be pretty easy to explain how to set up on various IDEs. All-in-all, I think it’s almost just as easy, and it just comes down to personal preference. This is just the way I’ve chosen to do it because it’s the way I’ve always done it.

As for using git, I believe this should be all up to the plugin creator (unless there’s something in the sponge license that states that plugins must be open-source). I may create a section later about it, but I don’t think I should worry about that quite yet.

Really good ! I love it !
I’m french, may i translate that please ? :smile:
If you can explain somea little more things this will be perfect :slight_smile: like : how to create auto message
The people who are reading, really like make an other thing but they can’t because don’t know the api and the Java code :confused:

Tried it out. Ran gradlew 3 times. The builds folder has ‘classes’ and ‘dependency-cache’. Not libs.
Help?

Yea, feel free to translate! I’ll put a link to it if you do. I’m going to be updating this often. Right now, the api doesn’t support enough features to really show how to do a whole lot.

Ok perfect, i do it this week end :smiley_cat:
Thanks you for future update :slight_smile:

Nice works and easy to read!

This is what I am waiting for : How to use commands :smiley:

Thanks for the positive feedback everybody :slight_smile:

Good job man! Keep the good work ^^

Thanks mate! Will do :slight_smile:

I just wanted to point out that SpongeEventHandler was renamed to Subscribe, according to Rename SpongeEventHandler to something more consistent by AedDev · Pull Request #175 · SpongePowered/SpongeAPI · GitHub
I think the tutorial document should be updated to reflect that. I was a little lost as I followed along. :stuck_out_tongue:

By the way, I absolutely love your tutorial. It’s so thorough and doesn’t skip a single step. I hate tutorials that assume you know certain things and expect you to figure them out.

Sorry it took a little while, but I’ve fixed it now :slight_smile: Thanks for letting me know!

Hello there, I was wondering if you were going to update the Sponge Coding For Dummies google doc anytime soon. If you are planning to stop working on it that would be fine, but I was really looking forward to this, because I’ve been wanting to start coding plugins for my server.

Also, I still have an error with event.getPluginLog(), even though the API is out now. It says that org.slf4j.Logger is indirectly referenced from required .class files. I’m not entirely sure what this means, but when I googled it, I found slf4j’s API for logging stuff and whatnot, so I downloaded it and added the main api class file to the build path and tried importing org.slf4j.Logger, but that created about 6 new errors. I’m pretty new to using Java with any sort of APIs, so I don’t know what’s going on at all. I’m hoping you can help me, but if not, thanks anyway!

1 Like

[quote=“mstuff63, post:16, topic:4264, full:true”]
Hello there, I was wondering if you were going to update the Sponge Coding For Dummies google doc anytime soon. If you are planning to stop working on it that would be fine, but I was really looking forward to this, because I’ve been wanting to start coding plugins for my server.

Also, I still have an error with event.getPluginLog(), even though the API is out now. It says that org.slf4j.Logger is indirectly referenced from required .class files. I’m not entirely sure what this means, but when I googled it, I found slf4j’s API for logging stuff and whatnot, so I downloaded it and added the main api class file to the build path and tried importing org.slf4j.Logger, but that created about 6 new errors. I’m pretty new to using Java with any sort of APIs, so I don’t know what’s going on at all. I’m hoping you can help me, but if not, thanks anyway!
[/quote]Yea, as of right now, the google doc is out of date. I’m hoping to get back to updating it when the server implementation is released so we can actually test our plugins. The error that you mentioned will (hopefully) be addressed once the doc is updated.

All that you need to do is import both sponge-1.8-11.14.0.1239-SNAPSHOT-release.jar and sponge-1.8-11.14.0.1239-SNAPSHOT.jar in order to have org.slf4j and org.spongepowered, including the API.

Forgive me one of your dummies is here.

‘Build Path -> Configure Build Path. At the top of that window, choose the Libraries tab, and click on the Add External Jars button on the right side of that window. You will now be presented with a file browser, where you will need to browse to Sponge. It should be located in SpongeAPI\build\libs’

When I look in the SpongeAPI-master\build folder all I find is ‘‘classes’’ and ‘‘dependency-cache’’’

You need to run ./gradlew build. It should say that somewhere in the tutorial.