Search in sources :

Example 16 with LanguageManager

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);
}
Also used : ICombatManager(com.github.sirblobman.combatlogx.api.manager.ICombatManager) DecimalFormat(java.text.DecimalFormat) LanguageManager(com.github.sirblobman.api.language.LanguageManager)

Example 17 with LanguageManager

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);
}
Also used : ICombatManager(com.github.sirblobman.combatlogx.api.manager.ICombatManager) LanguageManager(com.github.sirblobman.api.language.LanguageManager)

Example 18 with LanguageManager

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);
}
Also used : DecimalFormat(java.text.DecimalFormat) LanguageManager(com.github.sirblobman.api.language.LanguageManager)

Example 19 with LanguageManager

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);
}
Also used : ICombatManager(com.github.sirblobman.combatlogx.api.manager.ICombatManager) LanguageManager(com.github.sirblobman.api.language.LanguageManager)

Example 20 with LanguageManager

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);
}
Also used : LanguageManager(com.github.sirblobman.api.language.LanguageManager)

Aggregations

LanguageManager (com.github.sirblobman.api.language.LanguageManager)36 ICombatLogX (com.github.sirblobman.combatlogx.api.ICombatLogX)12 Player (org.bukkit.entity.Player)12 ConfigurationManager (com.github.sirblobman.api.configuration.ConfigurationManager)9 YamlConfiguration (org.bukkit.configuration.file.YamlConfiguration)9 ICombatManager (com.github.sirblobman.combatlogx.api.manager.ICombatManager)7 Replacer (com.github.sirblobman.api.language.Replacer)6 NewbieHelperExpansion (combatlogx.expansion.newbie.helper.NewbieHelperExpansion)6 PVPManager (combatlogx.expansion.newbie.helper.manager.PVPManager)6 Collections (java.util.Collections)6 List (java.util.List)6 CommandSender (org.bukkit.command.CommandSender)6 Set (java.util.Set)5 MultiVersionHandler (com.github.sirblobman.api.nms.MultiVersionHandler)4 ProtectionManager (combatlogx.expansion.newbie.helper.manager.ProtectionManager)4 DecimalFormat (java.text.DecimalFormat)4 ArrayList (java.util.ArrayList)4 Arrays (java.util.Arrays)4 Locale (java.util.Locale)4 UUID (java.util.UUID)4