Sueta
DE

DevS API

BETA 0.1.1

Useful API for development use

·Plugin

| DEVS API |
By 8ML - Founder of DevS
Beta v0.1
_________________________________________________________

About API
The DevS API was specially designed for quick access to commonly used things while developing spigot plugins.
The API is in beta and will be constantly updated with new things and new bug fixes.
Please note that this is an API and not a standalone plugin.

How to Use
To use the DevS API you will need to have the jar in your libraries (Where your spigot.jar is)
And you will need the jar in the plugins folder.

If you are using this api in a public plugin, please link this page.

_________________________________________________________

API FEATURES

Command Manager

To use the command manager, your class has to extend DCommand and implements the required methods:

public class YourCMD extends DCommand() {

    //For aliases you can simply do this:
    //new String[]{"alias1", "alias2"}) and so on.
    //For no aliases simply do new String[0]

    public YourCMD() {
        super("label", aliases, "description", "permission");
    }
 
    public void execute(Player player, String[] args) {
        //Your code Here
    }
 
}


There is also a manager for console commands:

public class YourConsoleCMD extends DConsoleCommand() {

    public YourConsoleCMD() {
        super("label", aliases, "description");
    }
 
    public void execute(ConsoleCommandSender s, String[] args) {
        //Your code Here
    }

}


At the end you will have to add a line in your onEnable method:

public void onEnable() {
    DCMD.RegisterCommand(new YourCMD(), this);
    DCMD.RegisterCommand(new YourConsoleCMD(), this);
}


You don't need to add the commands to your plugin.yml


Configuration Files

To use the configuration file system you will need to make a variable in the onEnable method for the configuration file:

public void onEnable() {
    public PluginConfigurationFile yourconfig = new PluginConfigurationFile(this, "yourconfig.yml", "yourconfig.yml");
   
    yourconfig.options.copyDefaults(true);
    yourconfig.reload();
    yourconfig.save();
   
}

Now you can use it as a normal config:

yourconfig.set();
yourconfig.get(); (getString, getInt, getLong, etc)

You can make multiple config files with custom names.


MySQL Database

To use the mysql database system, you will have to make the database variable in your onEnable method:

public void onEnable() {
    MySQLDatabase db = new MySQLDatabase("host", "database", "user", "password", port, "table");
 
    //Now you can do db. and get a bunch of methods you can use as forexample:
    //db.close();
    //db.statement(statement) this will return a PreparedStatement
}

Please note that this system is work in progress as everything else, all systems will be improved in the future.


GUI

To use the GUI System you first need to create the gui:

GUI gui = new GUI("name", GUISize);

For the GUISize you will have to use the GUISize enum:

GUI.GUISize

The different sizes are:

One = 9
Two = 18
Three = 27
Four = 36
Five = 45
Six = 54


Now you can add things to the gui:

gui.addItem(itemstack, "name", slot, "command"); //for the command part you can simply do "NONE" if you don't want a command for the item

gui.addLore(List<String>); //Add a lore[/SIZE]
 
gui.getItem(slot); //Get the item at the slot specified

gui.getSlot(name); //Get the slot of the item name you specified when adding the item

And to show it to a player do:

gui.open(player);


Scoreboard Manager

To Use the Scoreboard manager you first need to create the scoreboard:

DScoreboard sb = new DScoreboard("title");

Now you can make your scoreboard interesting:

sb.setSlot(slot, "value") //Show a value on your scoreboard

You can also customize the update time and permissions if you want any permissions

sb.setScoreboardPermission(true);
sb.setScoreboardPermissionValue("yourpermission");

sb.setScoreboardUpdater(true);
sb.setScoreboardUpdaterValue(seconds);

Utilities
Utilities Classes

TimeUtil - Different utils to do with time
S - Easy convert values to a string value
MSG - Messaging utils
Server - Server Utils

_________________________________________________________

About DevS Studios

DevS Studios is a team dedicated to creating quality plugins for everyone to enjoy.

We consists of just me (8ML) at the current moment, and we are looking for team members

You can join our discord servers for more information

DevS Team:
https://discord.gg/npszjYQ

DevS Services:
https://discord.gg/GC9sjYD

_______________________________________

Similar projects

Plugin →