ETERNALCORE / GUIDE

Developer API

Learn how to use the EternalCore API in your own plugins.

Edit on GitHub

Introduction#

We support developers who want to create their own plugins using our API. We provide a simple and easy-to-use API.

Dependency Management#

To use our API, you need to install the correct artifact. Our plugin supports Maven, Gradle Kotlin, Gradle Groovy, and SBT. Check the Maven Repository for the latest release.

Add repository#

maven("https://repo.eternalcode.pl/releases")

Add dependency#

compileOnly("com.eternalcode:eternalcore-api:1.1.0")

plugin.yml#

depend: [EternalCore]

Usage#

Create an instance of EternalCoreAPI:

EternalCoreAPI eternalCoreAPI = EternalCoreApiProvider.provide();

Available Services#

ClassProvide method
AfkServicegetAfkService()
SpawnServicegetSpawnService()
CatboyServicegetCatboyService()
TeleportServicegetTeleportService()
RandomTeleportServicegetRandomTeleportService()

Examples#

AfkService#

public class YourPlugin extends JavaPlugin {

    private EternalCoreApi eternalCoreApi;
    private AfkService afkService;

    @Override
    public onEnable() {
        this.eternalCoreApi = EternalCoreProvider.provide();
        this.afkService = eternalCoreApi.getAfkService();
    }
}

Check if player is AFK:

if (afkService.isAfk(player.getUniqueId())) {
    // Player is AFK
}

Mark player as AFK:

if (!afkService.isAfk(player.getUniqueId())) {
    Afk afkPlayer = afkService.markAfk(player.getUniqueId(), AfkReason.PLUGIN);
}

CatboyService#

if (player.getName().equals("Rollczi")) {
    catboyService.markAsCatboy(player, Cat.Type.BLACK);
}