1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Addon development

Dec 3, 2018
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:
    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:

    First we need to create a new blank Java Project.
    • In Eclipse: File -> New -> Java Project
    [​IMG]

    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.

    [​IMG]

    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:


    [​IMG]
    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.

    [​IMG]

    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.
    [​IMG]
    • In Eclipse: a window like this will appear, then navigate to Java build path -> Libraries (Tab) -> Add external jars
    [​IMG]
    • 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.
    [​IMG]

    Now we're all setup and ready to start coding! Lets create our first package.
    • In Eclipse: Right click the "src" file -> New -> Package
    [​IMG]
    • 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"

    [​IMG]

    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.
    [​IMG]

    [​IMG]

    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

Tilomi likes this.