Init your plugin

Let's init your plugin to use Kap easy Menu !

There is 2 important points :

  • YML file requirement

  • Your main class plugin

YML File

To begin, you have to add Kap Easy Menu in your dependencies plugin. To do this you juste have to write these lines below :

depend:
  - KapEasyMenu

This line says that your plugin gonna init after Kap Easy Menu. This is made to do not have null pointer exception while your server is running.

Main Class

Let's add a variable that contain the menu manager. You just have to follow the code below:

import fr.kap35.kapeasymenu.Menu.GuiMenu;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class MyPlugin extends JavaPlugin {

    IGuiManager guiManager;

    @Override
    public void onEnable() {
        ...
        guiManager = ((KapEasyMenu)Bukkit.getServer().getPluginManager().getPlugin("KapEasyMenu")).getGuiManager();
        ...
    }

    public IGuiManager getGuiManager() {
        return guiManager;
    }

}

With this part of code you can now : create / add / open your own menus !

Last updated