Skip to content

Developer API

realpeyaj edited this page Jul 6, 2026 · 6 revisions

Developer API Integration Guide

This page explains how to compile against and integrate with the peyajAuth API.

Since peyajAuth is obfuscated for security, we explicitly protect the API package from name scrambling. You can compile your custom plugins against it by using your compiled peyajAuth.jar as a local project dependency.


Step 1: Add the Dependency

Place the peyajAuth.jar into your project's libs directory and configure your build tool:

Gradle Kotlin DSL (build.gradle.kts):

repositories {
    flatDir {
        dirs("libs")
    }
}

dependencies {
    compileOnly(files("libs/peyajAuth.jar"))
}

Maven (pom.xml):

<dependency>
    <groupId>me.peyaj</groupId>
    <artifactId>peyajauth</artifactId>
    <version>1.0</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/libs/peyajAuth.jar</systemPath>
</dependency>

Step 2: Declare in plugin.yml

To ensure your plugin loads after peyajAuth:

depend: [peyajAuth]

Step 3: Call API in Java

You can retrieve the singleton API provider instance:

import me.peyaj.peyajauth.api.PeyajAuthAPI;
import org.bukkit.entity.Player;

public class MyPlugin {
    public void performAction(Player player) {
        // Fetch instance
        PeyajAuthAPI api = PeyajAuthAPI.getInstance();
        
        // Check if authenticated
        if (api.isAuthenticated(player)) {
            player.sendMessage("Welcome back, verified user!");
        }
        
        // Check if premium account
        if (api.isPremium(player.getUniqueId())) {
            player.sendMessage("Using official Mojang account!");
        }
    }
}

Clone this wiki locally