LocatorBarAPI can be integrated into your server setup using one of two approaches:
- As a Standalone Plugin: Drop the jar in your server
plugins/directory and compile your plugin against it. - As a Shaded Library: Bundle the API directly inside your own plugin jar without requiring users to install an extra plugin.
- Download or build
LocatorBarAPI-1.0.0.jar. - Place
LocatorBarAPI-1.0.0.jarinto your Paper server'splugins/folder. - Start or reload the server. LocatorBarAPI will automatically enable the
locatorBargamerule across all worlds.
If your plugin uses Paper's modern plugin loader:
name: MyCustomPlugin
version: 1.0.0
main: com.example.plugin.MyCustomPlugin
api-version: '1.21'
dependencies:
server:
LocatorBarAPI:
load: BEFORE
required: truename: MyCustomPlugin
version: 1.0.0
main: com.example.plugin.MyCustomPlugin
api-version: '1.21'
depend: [LocatorBarAPI]repositories {
mavenCentral()
maven("https://jitpack.io")
}
dependencies {
compileOnly("com.github.mukulx:LocatorBarAPI:v1.0.0")
}<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.mukulx</groupId>
<artifactId>LocatorBarAPI</artifactId>
<version>v1.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>If you want your plugin to be self-contained as a single jar without requiring server administrators to install a separate API plugin:
plugins {
`java-library`
id("com.gradleup.shadow") version "8.3.5"
}
repositories {
mavenCentral()
maven("https://jitpack.io")
}
dependencies {
implementation("com.github.mukulx:LocatorBarAPI:v1.0.0")
}
tasks.shadowJar {
relocate("dev.mukulx.locatorbarapi", "com.example.plugin.libs.locatorbarapi")
}When shaded, call LocatorBarAPI.init(this) inside your plugin's onEnable() method and LocatorBarAPI.shutdown() in onDisable():
package com.example.plugin;
import dev.mukulx.locatorbarapi.LocatorBarAPI;
import org.bukkit.plugin.java.JavaPlugin;
public final class MyCustomPlugin extends JavaPlugin {
@Override
public void onEnable() {
// Initialize the LocatorBarAPI system
LocatorBarAPI.init(this);
if (!LocatorBarAPI.isAvailable()) {
getLogger().warning("LocatorBarAPI could not bind to NMS on this server build.");
return;
}
getLogger().info("LocatorBarAPI initialized successfully.");
}
@Override
public void onDisable() {
// Stop background tick tasks and release resources
LocatorBarAPI.shutdown();
}
}To check if LocatorBarAPI is functional at runtime:
if (LocatorBarAPI.isAvailable()) {
// Safe to use LocatorBarAPI methods
}You can also check if the world gamerule is enabled for a given player:
boolean enabled = LocatorBarAPI.isLocatorBarEnabled(player);