- Added documentation for new EloManager methods

This commit is contained in:
AlexTheCoder 2016-04-28 21:16:18 -04:00
parent 2887630cf8
commit 8e68d62356

View File

@ -138,6 +138,9 @@ public class EloManager extends MiniDbClientPlugin<EloClientData>
_eloTeams.get(displayName).Winner = true; _eloTeams.get(displayName).Winner = true;
} }
/**
* Method for quickly checking if a player is banned from ranked games
*/
public boolean isRankBanned(int accountId) public boolean isRankBanned(int accountId)
{ {
boolean banExpired = System.currentTimeMillis() >= getRankBanExpiry(accountId); boolean banExpired = System.currentTimeMillis() >= getRankBanExpiry(accountId);
@ -152,16 +155,25 @@ public class EloManager extends MiniDbClientPlugin<EloClientData>
return !banExpired; return !banExpired;
} }
/**
* Method for getting a player's remaining ranked game ban duration if applicable
*/
public long getRankBanExpiry(int accountId) public long getRankBanExpiry(int accountId)
{ {
return _repository.getBanExpiry(accountId); return _repository.getBanExpiry(accountId);
} }
/**
* Method for banning a player from joining ranked games temporarily
*/
public void banFromRanked(int accountId) public void banFromRanked(int accountId)
{ {
_repository.addRankedBan(accountId); _repository.addRankedBan(accountId);
} }
/**
* Method called when game ends to calculate new Elo and award it
*/
public void endMatch(int gameId) public void endMatch(int gameId)
{ {
EloTeam teamWinner = null; EloTeam teamWinner = null;
@ -245,6 +257,9 @@ public class EloManager extends MiniDbClientPlugin<EloClientData>
_visual = visual; _visual = visual;
} }
/*
* Method for fetching the proper division for a given Elo value
*/
public static EloDivision getDivision(int elo) public static EloDivision getDivision(int elo)
{ {
for (EloDivision ed : EloDivision.values()) for (EloDivision ed : EloDivision.values())
@ -279,6 +294,9 @@ public class EloManager extends MiniDbClientPlugin<EloClientData>
return _disp; return _disp;
} }
/**
* Method for fetching the Itemstack that represents a player's division and their progress in it
*/
public ItemStack getVisual(int elo) public ItemStack getVisual(int elo)
{ {
ItemBuilder build = new ItemBuilder(_visual); ItemBuilder build = new ItemBuilder(_visual);