Added API to get a players rank on the leaderboards

This commit is contained in:
TfT_02
2013-08-13 09:37:45 +02:00
parent 5441fcc374
commit 3ddd8d2056
2 changed files with 36 additions and 1 deletions

View File

@ -435,6 +435,40 @@ public final class ExperienceAPI {
return Config.getInstance().getPowerLevelCap();
}
/**
* Get the position on the leaderboard of a player.
* </br>
* This function is designed for API usage.
*
* @param playerName The name of the player to check
* @param skillType The skill to check
*
* @throws InvalidSkillException if the given skill is not valid
* @throws InvalidPlayerException if the given player does not exist in the database
* @throws UnsupportedOperationException if the given skill is a child skill
*
* @return the position on the leaderboard
*/
public static int getPlayerRankSkill(String playerName, String skillType) {
return mcMMO.getDatabaseManager().readRank(getOfflineProfile(playerName).getPlayerName()).get(getNonChildSkillType(skillType).toString());
}
/**
* Get the position on the power level leaderboard of a player.
* </br>
* This function is designed for API usage.
*
* @param playerName The name of the player to check
*
* @throws InvalidPlayerException if the given player does not exist in the database
*
* @return the position on the power level leaderboard
*/
public static int getPlayerRankOverall(String playerName) {
return mcMMO.getDatabaseManager().readRank(getOfflineProfile(playerName).getPlayerName()).get("ALL");
}
/**
* Sets the level of a player in a specific skill type.
* </br>