Skip to content

API Introduction

Robin edited this page Nov 28, 2022 · 1 revision

Introduction

EternalTags has an API for retrieving or modifying plugin data. If you have any suggestions to make around the API, Please create an Issue

Setup

Using Gradle or Maven is recommended to include the dependency for EternalTags into your plugin.

Gradle

repositories {
    maven { url "https://repo.rosewooddev.io/repository/public/" }
}

dependencies {
    compileOnly 'xyz.oribuin:eternaltags:1.1.6'
}

Maven

<repositories>
    <repository>
        <id>rosewood-repo</id>
        <url>https://repo.rosewooddev.io/repository/public/</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>xyz.oribuin</groupId>
        <artifactId>eternaltags</artifactId>
        <version>1.1.6</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

Getting an API Instance

In order to use the API, you need to get the API instance. Below is a provided example for getting it.

import xyz.oribuin.eternaltags.EternalAPI;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class Example extends JavaPlugin {
    private EternalAPI tagsAPI;

    @Override
    public void onEnable() {
        if (Bukkit.getPluginManager().isPluginEnabled("EternalTags")) {
            this.tagsAPI = EternalAPI.getInstance();
        }

        // When you want to access the API, check if the instance is null
        if (this.tagsAPI != null) {
            // Do stuff with the API here
        }
    }
}