Welcome to the Hangar Open Beta. Please report any issue you encounter on GitHub!
Avatar for Olaneria

The all new modern permissions system.

Report OlaPermissions?

OlaPermissions API Developer Guide

Welcome to the OlaPermissions API! Our entire ecosystem is built around a custom, platform-agnostic framework that allows you to write one single addon that works natively on both Paper and Velocity.

1. Adding the Dependency

The OlaPermissions API is officially published to Maven Central, meaning you don't need to add any custom repositories to your build script.

Gradle (Kotlin DSL)

repositories {
    mavenCentral()
}

dependencies {
    compileOnly("com.olaneria.repo:olapermissions-api:1.0.0")
}

Maven

<dependency>
    <groupId>com.olaneria.repo</groupId>
    <artifactId>olapermissions-api</artifactId>
    <version>1.0.0</version>
    <scope>provided</scope>
</dependency>

2. Accessing the API

The entry point for all operations is the OlaPermissionsAPI singleton class. Since it's platform-agnostic, the syntax is identical no matter what server software you are building for.

import com.olaneria.olapermissions.common.api.OlaPermissionsAPI;

public class MyAddon {
    public void start() {
        OlaPermissionsAPI api = OlaPermissionsAPI.get();
        // Do something with the API!
    }
}

3. Listening to Events

OlaPermissions utilizes its own custom EventBus to ensure cross-platform compatibility. Do not use the Bukkit or Velocity event listeners for OlaPermissions events.

Instead, subscribe directly via our Event Bus:

import com.olaneria.olapermissions.common.api.OlaPermissionsAPI;
import com.olaneria.olapermissions.common.api.events.UserPromoteEvent;

public class RankupAnnouncer {
    
    public void onEnable() {
        // Subscribe to an event
        OlaPermissionsAPI.get().getEventBus().subscribe(UserPromoteEvent.class, event -> {
            String target = event.getUser().getIdentifier();
            String newGroup = event.getNewGroup();
            String track = event.getTrack().getName();
            
            System.out.println(target + " just ranked up to " + newGroup + " on the " + track + " track!");
        });
    }
}

Warning

All OlaPermissions events are executed asynchronously. If you need to manipulate the world, spawn entities, or use synchronous Bukkit methods in response to an event, you must schedule a task back on the main server thread.