Skip to content
This repository was archived by the owner on Jul 4, 2022. It is now read-only.

Create_Own_Library_Extentions

Nico edited this page Sep 17, 2020 · 6 revisions

Create own libraries

Libraries are located in the ./libraries folder. Libraries that are containing a library.json file, will be loaded as a SimplixApplication. Because of this, your applications will be able to require a specific library to be loaded before it starts up. SimplixLibraries are also capable of depending on each other.

Benefits

The advantage of making your library loadable as a SimplixLibrary is that it will be enabled to use the full benefits of the SimplixCore including its dependency injection capabilities without the library needing to be a plugin. This is a benefit since it is nasty to make a library that is loaded independently from BungeeCord / Spigot since you need to define a class that extends JavaPlugin/Plugin and has to contain an plugin.yml / bungee.yml file. Also, the capabilities of libraries to depend on each other has some great new possibilities that come with it.

Creating own library

To create make your library loadable as a SimplixLibrary, you just have to create an library.json in your resources folder.

{
  "name": "Example",
  "version": "1.0",
  "authors": ["SimplixSoftworks"],
  "mainClass": "dev.simplix.example.Example"
}

Let's take a look into the specified main class.

@SimplixApplication(name = "Example", version = "1.0", authors="SimplixSoftworks")
public class Example {}

As you can see this class body is empty and is only needed for registration at the SimplixInstaller.

Example: Cirrus