<aside> ⚠️ This API is not the library you have to use if you want to create leaderboards for your own plugins! If you create plugins that should create own leaderboards, take a look at this.
</aside>
<aside> ⚠️ The API is still an alpha version! This guide is still in progress.
</aside>
<aside> ⚠️ Make sure the API plugin is installed on your server! Download here.
</aside>
<repositories>
<repository>
<id>repsy</id>
<url><https://repo.repsy.io/mvn/hannes/mc-rankings></url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>de.hthoene</groupId>
<artifactId>mcrankings-api</artifactId>
<version>1.0.0-alpha</version>
<scope>provided</scope>
</dependency>
</dependencies>
depend: [McRankingsAPI]
private static final McRankingsAPI mcRankingsAPI = (McRankingsAPI) Bukkit.getServer().getPluginManager().getPlugin("McRankingsAPI");
LeaderboardConnection leaderboardConnection = mcRankingsAPI.getLeaderboard("PluginYouWantToAccess", 0);
Parameter 1: String
→ Name of the plugin you want to access
Paramter 2: Integer
→ The leaderboard ID of the plugin you want to access
leaderboardConnection.getPage(0, 5, new LeaderboardResult() {
@Override
public void onSuccess(List<Ranking> list) {
list.forEach(ranking -> {
getLogger().info(ranking.getUsername() + " -> " + ranking.getIndex());
});
}
@Override
public void onFailure(String message) {
getLogger().warning(message);
}
});
Parameter 1: Integer
→ Page you want to load (starting at 0)
Parameter 2: Integer
→ Page size (amount of entries you will get per page)
Paramter 3: LeaderboardResult
Interface → Callbacks when the results got fetched