Skip to content

Plugin Integration Recipes with RankForge API – Complete Code Samples

This guide provides copy-paste ready recipes for integrating your Minecraft plugin with RankForge. Ensure you have reviewed Dependency Setup.

Project structure:

  • Directorysrc/main/
    • Directoryjava/com/example/myplugin/
      • MyPlugin.java
      • RankForgeHook.java
    • Directoryresources/
      • plugin.yml
name: MyPlugin
version: 1.0.0
main: com.example.myplugin.MyPlugin
api-version: '1.21'
folia-supported: true
softdepend: [RankForge]
commands:
mystats:
description: View your RankForge stats
usage: /mystats

When calling from async or scheduled tasks on Paper & Folia:

import io.papermc.paper.threadedregions.scheduler.GlobalRegionScheduler;
import org.bukkit.Bukkit;
import xyz.noxlydev.rankforge.api.RankForgeAPI;
public void addPointsAsyncSafe(Player player, int points) {
// Schedules synchronously onto the global/entity thread
Bukkit.getGlobalRegionScheduler().execute(plugin, () -> {
if (RankForgeAPI.isAvailable()) {
RankForgeAPI.get().addPoints(player, points);
}
});
}