Tutorials to learn how to develop plugins for SpongeAPI?

I’m currently learning how to code in Java and I’m coming to a point where I will like to learn how to code plugins for the SpongeAPI. I didn’t find a lot of tutorials in video or by text for complete beginners to the Minecraft development community. So this topic is here for two reasons.

First, I wanted to know if you have tutorials to advise me with in mind that I am a beginner in Minecraft development.

Second, I learn Java at Treehouse and I recently made a request for tutorials on Minecraft mods and plugins developement. They add it to the Treehouse Java Content Roadmap and I think that it will be cool if you can vote for this request.

Thanks in advance to all for your advices and your remarks !

The SpongeDocs are always a good place to start. There are a few [Tutorials] (Tutorials — Sponge 7.2.0 documentation) on setting up the IDE, and plenty of pages with example code.

I’d advised you wait until you can so “I have already learned Java” before you start developing SpongeAPI plugins. SpongeAPI is not only an advanced API, but, though awesome, has it’s own set of (awesome) conventions and ideas that are not necessarily part of the main java language. Furthermore, questions on the plugin-development page which ask for java help, or are the result of a misunderstanding of the java language, are frowned upon. Though, it does depend on how advanced you are at the moment. If you understand classes, methods, fields, class hierarchies, polymorphism, modifiers (public, private, protected, static, final, etc.), program flow (if, while, do-while, for, for-each, switch, try-catch, try-catch-finally, try-with-resource), have a decent understanding of what threading is and some of the problems multi-threading can cause if used improperly, know the java naming conventions, understand java 8 features, and know what annotations are and how to apply them.

If you know all that stuff, you should be ~okay to start Sponge. If not, complete more of the Java course you’re taking… Start by looking at the sponge docs, as they cover basically everything. If the docs don’t make sense, it’s more likely the result of a misunderstanding on your part. Not because prone to misunderstanding, but because the docs are the result of a collaboration of multiple intermediates and experts writing detailed instructions on how to sponge… so they’re usually pretty good. If they’re not, and they really need some clarification, feel free to post in the plugin development section.

That should not matter. If you have a full understanding of Java, and at least know what minecraft is (blocks, worlds, items, and more) you should be fine. (Do you know what TileEntities and ItemStacks are? Those are important…). As long as you’ve played the game enough to be “good” at it, all is probably well. (Have you defeated the EnderDragon?)

Also, for clarification about specific methods or classes or fields, see the Java Docs. (Which should be accessible in your IDE if you have it set up correctly. On that note, what IDE do you use? It’s a matter of personal preference, but I personal prefer Intellij because it’s just better. In my opinion. There are those that greatly prefer eclipse, which is just as valid an opinion.)

Aaand I was just ninja’d by @Inscrutable

3 Likes

Thanks for the advice @Inscrutable !

@Socratic_Phoenix :

I used “currently” because, yes, I have the fundamentals that you are talking about but I need to practice more to be confident when I say that I know how to code in Java.

Also, I have played Minecraft since 2010 but I just started to be really interested in development. I know what are TileEntities, ItemStacks and I already defeated the EnderDragon, more than one time.

I use IntelliJ IDEA with the Minecraft Dev plugin. I will check the SpongeDocs and also the JavaDocs.

1 Like

I could not disagree more. If I had not done exactly this with Bukkit about 7 years ago, it’s fairly likely I wouldn’t have gotten involved with CS at all, go to school for it, and ultimately want to start a career in it (one day lol). I firmly believe that these kinds of platforms are a very good learning tool for beginners even if they’re starting out with simpler plugins–especially if an interest for programming is coupled with a game you like.

4 Likes

That is exactly what I’ve done and I don’t regret it one bit, I started out learning java for about 2-3 months and even though I wasn’t exactly comfortable with some of the more advanced/newer features of Java at the time, I felt confident in what I was doing.
Now learning through lessons and completing exercises was all well and good, I wanted to start doing things that would have an impact, that might even help others. I’ve always been a huge fan of Minecraft since I discovered it and eventually decided to try out out making plugins.

1 Like

My opinion: The only knowledge required is knowing what you don’t know, and knowing whether it’s Sponge or Java. What I mean is that it’s none of my business if you’re trying to remake PJP without knowing the difference between a bracket and an angle bracket, so long as you keep Sponge questions here and “what be generics” questions on Stack Overflow.

3 Likes

I suppose different experiences shape different opinions… I did the same with mods and Bukkit, and I have to say I do regret it… Instead of focusing on Java concepts, I focused on making plugins and mods, and it took me much too long to understand basic Java. Of course, both opinions are valid, and I agree that interest in a game is a great spur for programming.

In the end, that’s really all that matters, but sometimes it’s hard to know what you don’t know if you don’t know things you should know.

So, conclusion: if you want to program Sponge, you don’t necessarily need to first know Java, but you should look at Java tutorials as well as the sponge docs, and must be able to differentiate between problems caused by a java misunderstanding or mistake, or a sponge misunderstanding, misuse, or bug…

2 Likes

Thanks to @windy, @RysingDragon and @pie_flavor for your advices !

I think that I will do both ! I will continue to learn more deeply the Java language, but I will also read the SpongeDocs and start coding plugins.

Thanks to all, really !

1 Like