Skip to content

Getting started with API

LegameMc edited this page May 22, 2022 · 5 revisions

Introduction

This API is still in its early stages, please create an issue at here if you have any suggestions or find any problems.

Import the API

Import with jar: EnchantGui-API.jar


Import with Maven:

Replace {VERSION} with the number of the latest version

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependency>
    <groupId>com.github.LegameMc</groupId>
    <artifactId>EnchantGui-API</artifactId>
    <version>{VERSION}</version>
</dependency>

Import with Gradle:

Replace {VERSION} with the number of the latest version

repositories {
    maven { url 'https://jitpack.io' }
}
dependencies {
    implementation 'com.github.LegameMc:EnchantGui-API:{VERSION}'
}

Getting API instance

import com.gmail.legamemc.enchantgui.api.EnchantGuiAPI;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;

public class MyPlugin extends JavaPlugin {
    private EnchantGuiAPI enchantGuiAPI;
    
    @Override
    public void onEnable() {

        PluginManager pluginManager = getServer().getPluginManager();
        if(pluginManager.isPluginEnabled("EnchantGui")){
            enchantGuiAPI = (EnchantGuiAPI) pluginManager.getPlugin("EnchantGui");
        }

    }

}

Edit plugin.yml

Don't forget to add EnchantGui into your softdepend or depend in your plugin.yml!

Example:

name: MyPlugin
main: com.gmail.legamemc.myplugin.MyPlugin
version: 1.0.0
author: Legamemc
# depend or softdepend, it depends on what you want
softdepend:
  - EnchantGui
Clone this wiki locally