Addon development

Hi SkUnity, LimeGlass here.

I feel that SkUnity is missing a main aspect of Skript, that being some sort of information on Skript Addons. So since the old forums had an addon development tutorial, I feel that we should get one back. I will be explaining in my best details how to create an addon from the ground up with every secret, workaround and tip I can provide on top of the main tutorial from the Skript API.

NOTE: Please take effort and time into your addons. SkUnity will not appreciate cheap quality addons made in a few hours on their site. Your addon will most likely get rejected if it's of such quality.

Scripts may take a few minutes to hours to create, but addons are suppose to be tested and well processed. So please don't release trash addons. Thank you.

Table on contents:

  • Getting started (This page)

  • Registering your Addon

  • Creating an Expression

  • Creating an Effect

  • Creating a Condition

  • Creating an Event

  • Creating a Type/ClassInfo

  • Creating Enum names (Finishing soon)

  • Tips and Tricks (Finishing soon)


Information:

So to begin this tutorial, It's excepted that you have some sort of basic Java understanding. You can google "Java 101" or look at some of these links provided:

And a well understanding of the Spigot API https://hub.spigotmc.org/

I self taught myself Java through playing around with it, trial and error and looking up documents about it. I also knew some other programing languages which did help understand more than starting from a blank canvas.

A good understanding of Skript coding is recommend aswell. If you don't know basic Skript coding, I think you're in the wrong starting location.

You may also choose to watch an updated Youtube video to help learn visually as well.

Requirements:


Eclipse is recommend to be used over the others as that is what Skript was coded in, and Bensku (Current Skript fork developer) recommends to keep it's format.

Eclipse Oxygen 4.2 is used in this tutorial. I will be going over every detail on how to start development of an addon, so some may already know parts of this, and you may skip ahead if you want.

If someone would like to add IntelliJ support. Please insert the process in a (SPOILER="IntelliJ") pull down at each bullet point with pictures too if you can. Thanks.

Getting started:

If you're experienced with making a new project, skip to registering your addon

First we need to create a new blank Java Project.

  • In Eclipse: File -> New -> Java Project




Then a new window will appear. Here you enter the name of your addon. Then press finish (May very via IDE)

  • Some addons have the wording "SK" in the name. This is just an adapted Skript terminology that over the years has developed. You may choose to follow this naming method if you wish. There has also been a new trend which is calling your addon by it's main purpose "skript-PURPOSE" So like skript-yaml or skript-vectors. The name is completely up to you.





Every Spigot plugin needs to have a plugin.yml in order for the plugin to load, so let's create a plugin.yml and put it in the file location of our Java Project we just made:



Keep in mind that you can't have spaces in the name node.

The version, name and main nodes are mandatory. If you have multiple authors you name it "authors:" and as a string array.



Next we need to add Skript and Spigot/PaperSpigot as a dependency for our addon.

  • In Eclipse: you right click the Java Project in the navigation panel, and go to properties.




  • In Eclipse: a window like this will appear, then navigate to Java build path -> Libraries (Tab) -> Add external jars




  • In Eclipse: add Skript (Latest version at the time reading this) and Spigot to the Libraries. Then once you have the files inserted click Apply and Close.




Now we're all setup and ready to start coding! Lets create our first package.

  • In Eclipse: Right click the "src" file -> New -> Package




  • In Eclipse: A window like this will appear. You can add the package name here.


Keep in mind that in Java the typically package naming consists of three dots or more. This is just a basic domain naming system. You also need to keep in mind that what ever you name this, must also be your "main" node in your plugin.yml or else Spigot won't understand where to startup your addon.

In my case, I am calling the package "me.limeglass.addon"



Then click Finish. Now we need to add our Main class. It's recommended to name your main class the name of your addon. So if this was Skript. The main class would be Skript.class

To add a class

  • In Eclipse: Right click the package that we just made and click new Class. Then name it your main class name discussed above, and click Finish.






Now we can start coding!

If you need any help feel free to PM LimeGlass on SkUnity or the SkUnity Discord. (Link at the bottom of the website)

This has been the Getting started section of the addon development.

To continue the tutorial go to the Registering your Addon section