use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class PlaceholderHelper method getTimeLeftDecimal.
public static String getTimeLeftDecimal(ICombatLogX plugin, Player player) {
LanguageManager languageManager = plugin.getLanguageManager();
ICombatManager combatManager = plugin.getCombatManager();
double millisLeft = combatManager.getTimerLeftMillis(player);
if (millisLeft <= 0.0D)
return languageManager.getMessage(player, "placeholder.time-left-zero", null, true);
double secondsLeft = (millisLeft / 1_000.0D);
DecimalFormat decimalFormat = getDecimalFormat(plugin, player);
return decimalFormat.format(secondsLeft);
}
use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class PlaceholderHelper method getTimeLeft.
public static String getTimeLeft(ICombatLogX plugin, Player player) {
ICombatManager combatManager = plugin.getCombatManager();
int secondsLeft = combatManager.getTimerLeftSeconds(player);
if (secondsLeft > 0)
return Integer.toString(secondsLeft);
LanguageManager languageManager = plugin.getLanguageManager();
return languageManager.getMessage(player, "placeholder.time-left-zero", null, true);
}
use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class PlaceholderHelper method getDecimalFormat.
public static DecimalFormat getDecimalFormat(ICombatLogX plugin, Player player) {
LanguageManager languageManager = plugin.getLanguageManager();
String decimalFormatString = languageManager.getMessage(player, "decimal-format", null, false);
return new DecimalFormat(decimalFormatString);
}
use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class PlaceholderHelper method getInCombat.
public static String getInCombat(ICombatLogX plugin, Player player) {
ICombatManager combatManager = plugin.getCombatManager();
LanguageManager languageManager = plugin.getLanguageManager();
boolean inCombat = combatManager.isInCombat(player);
String key = ("placeholder.status." + (inCombat ? "in-combat" : "not-in-combat"));
return languageManager.getMessage(player, key, null, true);
}
use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class ActionBarUpdater method getMessage.
private String getMessage(Player player, long timeLeftMillis) {
LanguageManager languageManager = getLanguageManager();
if (timeLeftMillis <= 0) {
String path = ("expansion.action-bar.ended");
return languageManager.getMessage(player, path, null, true);
}
String path = ("expansion.action-bar.timer");
String message = languageManager.getMessage(player, path, null, true);
if (message.isEmpty()) {
return null;
}
return replacePlaceholders(player, message, timeLeftMillis);
}
Aggregations