Home›Java›Mods›[API] KitAPI
ModsJava

[API] KitAPI

Minecraft Java mod. Download on the author's site.

⬇ Download on Spigot
A small code how to use this API:

NOTE: I'll upload the file when I've finished coding it!

Code (Text):
package net.kojelinhd.kitapi.main;

import net.kojelinhd.kitapi.Kit;
import net.kojelinhd.kitapi.KitManager;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.permissions.Permission;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.HashMap;

public class Main extends JavaPlugin {

    /********************************************************
     * NOTE: THIS PLUGIN ONLY CONTAINS A KIT-SYSTEM!        *
     *       THAT MEANS YOU HAVE TO CODE OTHER FEATURES     *
     *       LIKE A GUI (INVENTORY) OR SOMETHING ELSE!      *
     ********************************************************/

    //Enable Method - nothing special
    public void onEnable() {
 
        // Startup Message
        Bukkit.getConsoleSender().sendMessage("§8[§aKitAPI§8] §aenabled!");

        //Item and Meta
        ItemStack item = new ItemStack(Material.APPLE);
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName(ChatColor.BLUE + "TestItem");
        item.setItemMeta(meta);

        //Items for one / or more than one (as you can see) kit/s
        HashMap<Integer, ItemStack> items = new HashMap<Integer, ItemStack>();
        items.put(1, item);
        items.put(2, new ItemStack(Material.BEDROCK));

        //Permission
        Permission perm = new Permission("kit.glowstone");

        //KitManager | IMPORTANT: Call it ONLY ONCE in your Code!
        KitManager km = new KitManager();

        // Kit "Glowstone"
        Kit kit = new Kit("Glowstone", new ItemStack(Material.GLOWSTONE_DUST), items, 0, perm);
        km.registerKit(kit); /* You have to register every Kit! */

        //Items for TestKit
        ItemStack displayItemTest = new ItemStack(Material.BEDROCK);
        ItemMeta testMeta = displayItemTest.getItemMeta();
        testMeta.setDisplayName("Test!");
        displayItemTest.setItemMeta(testMeta);

        //Create a Test Kit
        Kit test = new Kit("Test", displayItemTest, items, 0, perm);
        km.registerKit(test); /* Register it...*/

        //Create a second Test Kit |-|-| You can have as many Kits you want!
        Kit test1 = new Kit("Test2", new ItemStack(Material.APPLE), items, 0, perm);
        km.registerKit(test1); /* Register it too!! | Dont forget!! ;) */

        //Output to test my Code
        System.out.println("List Kits as names:                       " + km.getRegisteredKitNames());
        System.out.println("List Kits as integer:                     " + km.getRegisteredKitsInInteger());
        System.out.println("Price of 'Test':                          " + km.getKitPrice(test));
        System.out.println("Permission of 'Test':                     " + km.getPermission(test).getName());
        System.out.println("Name of the display-item from 'Test':     " + km.getKitIcon(test).getItemMeta().getDisplayName());
        System.out.println("Displayname of items of 'Test', Level 1:  " + km.getItemsDisplayNames(test, 1));
        System.out.println("Items of 'Test', Level 2:                 " + km.getItems(test, 2));
    }

    //Disable Method - also very special xD!
    public void onDisable(){
        //Shutdown Message
        Bukkit.getConsoleSender().sendMessage("§8[§eKitAPI§8] §edisabled!");
    }

}
 
Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

[API] KitAPI is a free Minecraft Java mod. Downloaded 270 times (via Spigot). Download it and open it directly in the game.

Explore more