API

How to use our API

Add the plugin as a dependency:

repositories {
    maven {
        url = uri('https://repo.codemc.org/repository/maven-public/')
    }
}

dependencies {
    compileOnly 'me.Lorenzo0111:RocketPlaceholders:VERSION'
}

Get the API

RocketPlaceholdersAPI api = Bukkit.getServicesManager().load(RocketPlaceholdersAPI.class);
if (api != null) {
    this.getLogger().info("RocketPlaceholders hooked!");
} else {
    this.getLogger().severe("Unable to find RocketPlaceholdersAPI, disabling..");
    this.getServer().getPluginManager().disablePlugin(this);
}

How to add a placeholders

Without permissions nodes

this.getAPI().addPlaceholder(new PlaceholderBuilder("identifier", "text"));

With permissions nodes

this.api.addPlaceholder(new PlaceholderBuilder(new PlaceholderBuilder("identifier", "text").createPermissionNode("permission.example", "secret text"));

How to get all placeholders

Internal placeholders

this.getAPI().getInternalPlaceholders().getStorageManager().getInternalPlaceholders();

External placeholders

this.getAPI().getInternalPlaceholders().getStorageManager().getExternalPlaceholders().getHashMap();

Placeholders added via API won't synchronized with MySQL

Cookbook

Click here to view our cookbook.

Last updated