Developer API for the ModernJobs Spigot/Paper plugin.
Use this to interact with jobs, player data, leaderboards, and GUIs from your own plugin.
The API is hosted via JitPack. You do not need the plugin JAR on your classpath — just add the JitPack repository and the dependency below.
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.el211</groupId>
<artifactId>ModerJobs-API</artifactId>
<version>1.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
compileOnly 'com.github.el211:ModerJobs-API:1.0.0'
}Replace
1.0.0with the latest release tag, or usemain-SNAPSHOTto track the latest commit.
- Java 17+
- Paper / Spigot 1.21+
- ModernJobs installed on the server (
softdependordependon it in yourplugin.yml)
Make sure ModernJobs loads before your plugin:
softdepend:
- ModernJobsAlways retrieve the API through OJobsProvider — never instantiate it yourself.
import fr.oreo.modernjobs.api.OJobsApi;
import fr.oreo.modernjobs.api.OJobsProvider;
// Returns Optional.empty() if ModernJobs is not loaded
Optional<OJobsApi> api = OJobsProvider.get();
// Or throw if not available
OJobsApi api = OJobsProvider.getOrThrow();OJobsApi api = OJobsProvider.getOrThrow();
if (api.hasJob(player, "miner")) {
player.sendMessage("You are a Miner!");
}boolean joined = api.joinJob(player, "farmer");
boolean left = api.leaveJob(player, "farmer");api.giveXp(player, "miner", 50.0);api.setLevel(player.getUniqueId(), "miner", 10);api.getPlayerJobData(player.getUniqueId(), "miner").ifPresent(data -> {
int level = data.getLevel();
double xp = data.getXp();
int prestige = data.getPrestige();
});if (api.canPrestige(player, "miner")) {
api.prestige(player, "miner");
}// Per-job leaderboard
List<LeaderboardEntry> top = api.getLeaderboard("miner");
// Global leaderboard (sum of all job levels)
List<LeaderboardEntry> global = api.getGlobalLeaderboard();api.openMainMenu(player);
api.openJobMenu(player, "miner");
api.openLeaderboard(player);See OJobsApi.java for the complete list of available methods.