/** * Calculate the time remaining until the ability's cooldown expires. * * @param ability AbilityType whose cooldown to check * @return the number of seconds remaining before the cooldown expires */ public int calculateTimeRemaining(AbilityType ability) { long deactivatedTimestamp = profile.getAbilityDATS(ability) * Misc.TIME_CONVERSION_FACTOR; return (int) (((deactivatedTimestamp + (PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TIME_CONVERSION_FACTOR)) - System.currentTimeMillis()) / Misc.TIME_CONVERSION_FACTOR); }