Skip to content
This repository was archived by the owner on Sep 7, 2020. It is now read-only.

Developer API

Mike edited this page Jul 17, 2019 · 4 revisions

Getting started

This section assumes you already have an understanding of the Java programming language. The plugin has many features you can modify with your own plugins. You can create, modify, etc kits using the KitAPI class.

Using the KitAPI class

the KitAPI class can me initialized as such, KitAPI api = new KitAPI(); now, you have a variable, API, exposing the whole API to you.

Creating a kit programmatically

KitAPI

There are 2 very efficient ways of completing this task. One class you have access to is the 'KitBuilder' class, you may initialize this directly, KitBuilder kb = new KitBuilder(); or you can use the API as such, KitBuilder kb = api.createKit();.

KitBuilder

The beauty of the KitBuilder class really shows when you want to just create a kit as fast as possible, you can create an entire kit with a single line of code! This line might look something like so, KitData kd = api.createKit().add(new ItemStack(Material.DIAMOND_SWORD)).setIcon(Material.DIAMOND_BLOCK).setReplacing(false).build(). This one like of code will create a kit with a diamond sword, a diamond block icon for the /kit gui, and this kit will add to the player's inventory instead of replacing. it will also return with a 'KitData' class so you can use those methods in your kit.

Using the KitData class

Assuming you've read the previous section, you now should have access to a 'KitData' variable. With this you can do 3 main things, Modify the kit, Delete the kit, and give it to a player.

Modifying a kit

Say we want to change the icon of a kit on the fly, we can simply do this with the 'KitData' class as such, kd.setIcon(Material.OAK_LOG);. This will change the icon of the kit to an Oak log.

Deleting a kit

We can also delete a kit on the fly if we need to. that would probably look something like this, kd.delete();. After this is ran the kit will cease to exist permanently. Be careful with this one.

Giving a kit to a player

Giving a kit is simple, we can use the api directly for this. That would look like this, api.giveKit(kd, player);

Clone this wiki locally