I want to build a plugin,Who can teach me?

I have a good idea! I want to build a plugin that allows players to have limited life.
So the name of this plugin is “Limited-life”. But I can’t understand the sponge docs. I am in trouble. Who can help me?

I download these things:

What should I do? Need I more things? Hope someone can help me.:heart:

You won’t be needing .NET framework for this.

Choose between NetBeans or IntelliJ IDEA. You don’t need both. Choose IntelliJ IDEA since it “is fairly popular amongst a majority of the core Sponge team.” I believe IntelliJ IDEA also comes with Gradle, so you shouldn’t need to download and install Gradle on your computer.

Make sure you know how to use Git. If not, you can at least use Github Desktop to make it easier.

You shouldn’t need both Atom and Notepad++. IMO, would get rid of Atom since it performs too slowly (from experience) compared to other text editors. Notepad++ is good though.

Above all else: Learn to code fluently in Java
Even I, who has spent a few years (on and off) programming in Java (and various other languages), have learned some new things while making Sponge plugins, such as Optionals and Dependency Injection. I’ve also gotten more familiarity with lambda expressions.

It also helps to get familiar with Gradle. I didn’t know how to use it at first, but I got by with a little experimentation.

Other than that, you should really learn how to read the Sponge Docs yourself. If you don’t know something, just search it up on your favorite search engine.

Pro-tip: Experimentation is a good way of learning. (Except maybe in C++ / Assembly, since it may wreck your computer if you do something really bad. But Java is perfectly fine!)

Happy programming! ^.^

1 Like

Thanks for youhelp. But I can not understand this:

It is saying that by this point, your build.gradle file should be complete, with Sponge listed as a dependency (and remember to import the changes to Gradle).
So now you should make a new java class for your plugin under a new package.

Note that with Gradle, your java files should be in the folder ‘/src/main/java/’. You can look at other peoples’ plugins for reference. It’s all open source! Just don’t copy other people’s package names, since it should be unique to you.

If you do not understand what ‘class’ or ‘package’ means, then you need to invest some time in learning the basics of Java before writing a plugin. I’d recommend this regardless, actually, given your first post.

There are many, many, many websites, programs, and general areas of the internet dedicated to teaching Java. Some of them are actually useful. I’d obviously recommend fully knowing the language and a good portion of the standard library before attempting a high-level, high-complexity, advanced API like Sponge. To do otherwise is equivalent to starting a new, complicated, difficult video game on extra hard difficulty and skipping the tutorial. However, if you choose to go this path anyway, at least learn enough to know when your question is a Java question or a Sponge question. Questions related to the Sponge framework, API, and surrounding environs go here; questions about general programming concepts, the Java standard library, or the Java language go on Stack Overflow. Such as: what is a class and what is a package.

I recognize that this is not directly your question, but it is an anticipation of several more to come.

2 Likes

Could you tell me how to set the “package”?

Please note that SpongeDocs are not, and never will be, a “how to program in Java” tutorial. They are targeted at users who are already familiar with programming in a Java environment. If you find yourself lost in the specialised terminology of Java programming, I recommend you seek third-party tutorials to increase your familiarity.

Thanks. I will learn java.(hard :joy:)

Just so you know. You don’t need to learn anything about GUI’s or Networks when you eventually start programming your plugin. This is because Sponge handles that.

If you want to learn it then great however you will probably never use it. (Just saying this so you can cut a few corners).

I personally started learning java and when i felt comfortable enough i started to learn the API.

I would personally focuses on packages, classes, methods, variables, interfaces, abstract, enums, superclass, casting, exceptions, File, String, Integer (int), double, float, long, short (and other primary types) and annotation. These are the things i personally use most that are from Java

What I would say to learn is:

  • The concepts of programming flow. Start with Scratch or similar.
  • 100% of the language (syntax and structure) itself.
  • Concepts of the class system, hierarchies, and polymorphism.
  • Everything in java.lang and java.util.
  • The foundations of java.io.

This should just about set you up to start being able to use Sponge, though it will still be a rocky start.