Fix mcrank cd display

This commit is contained in:
nossr50 2019-04-12 15:24:01 -07:00
parent 33a68daa9c
commit 6e3c2fcb76
2 changed files with 6 additions and 1 deletions

View File

@ -10,6 +10,7 @@ Key:
Version 2.1.41
Fixed NullPointerException errors when trying to grab PlayerProfiles for players who have not loaded
Added new locale string Profile.PendingLoad
Fixed a display error preventing the remaining time on /mcrank from being shown if it was on cooldown
Version 2.1.40
(API) mcMMO will now return null in all cases for UserManager.getPlayerProfile() if they have not been loaded yet

View File

@ -98,7 +98,7 @@ public class McrankCommand implements TabExecutor {
long cooldownMillis = Math.max(Config.getInstance().getDatabasePlayerCooldown(), 1750);
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
sender.sendMessage(LocaleLoader.getString("Commands.Database.Cooldown"));
sender.sendMessage(LocaleLoader.getString("Commands.Database.Cooldown", getCDSeconds(mcMMOPlayer, cooldownMillis));
return;
}
@ -117,4 +117,8 @@ public class McrankCommand implements TabExecutor {
new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
}
private long getCDSeconds(McMMOPlayer mcMMOPlayer, long cooldownMillis) {
return (System.currentTimeMillis() - (mcMMOPlayer.getDatabaseATS() + cooldownMillis)) / 1000;
}
}