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

@ -11,7 +11,8 @@ Version 1.4.07-dev
+ Added snow to excavation + Added snow to excavation
+ Added new experience curve option. Cumulative curve, calculates experience needed for next level using power level. + Added new experience curve option. Cumulative curve, calculates experience needed for next level using power level.
+ Added extra settings to config.yml for Call of the Wild (Taming) + Added extra settings to config.yml for Call of the Wild (Taming)
+ Added a 5 cooldown after teleporting before Acrobatics XP can be earned. + Config option to disable + Added a 5 second cooldown after teleporting before Acrobatics XP can be earned. + Config option to disable
+ Added new API methods to ExperienceAPI to get a players rank on the leaderboards
+ Added new McMMOPlayerDeathPenaltyEvent, fired when a player dies and would lose levels + Added new McMMOPlayerDeathPenaltyEvent, fired when a player dies and would lose levels
= Fixed bug with Skull Splitter not finding the locale string = Fixed bug with Skull Splitter not finding the locale string
= Fixed issue where locale strings could cause the scoreboard header to be longer than 16 characters. = Fixed issue where locale strings could cause the scoreboard header to be longer than 16 characters.

View File

@ -435,6 +435,40 @@ public final class ExperienceAPI {
return Config.getInstance().getPowerLevelCap(); 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. * Sets the level of a player in a specific skill type.
* </br> * </br>