Search in sources :

Example 26 with LanguageManager

use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.

the class CustomScoreboard method updateScoreboard.

public void updateScoreboard() {
    List<String> lineList = getLines();
    int lineListSize = lineList.size();
    for (int line = 16; line > 0; line--) {
        int index = (16 - line);
        if (index >= lineListSize) {
            removeLine(line);
            continue;
        }
        String value = lineList.get(index);
        setLine(line, value);
    }
    Player player = getPlayer();
    LanguageManager languageManager = getLanguageManager();
    String title = languageManager.getMessage(player, "expansion.scoreboard.title", null, true);
    String titleReplaced = replacePlaceholders(title);
    this.objective.setDisplayName(titleReplaced);
}
Also used : Player(org.bukkit.entity.Player) LanguageManager(com.github.sirblobman.api.language.LanguageManager)

Example 27 with LanguageManager

use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.

the class CombatPlugin method broadcastDisableMessage.

private void broadcastDisableMessage() {
    ConfigurationManager configurationManager = getConfigurationManager();
    YamlConfiguration configuration = configurationManager.get("config.yml");
    if (!configuration.getBoolean("broadcast.on-disable")) {
        return;
    }
    LanguageManager languageManager = getLanguageManager();
    languageManager.broadcastMessage("broadcast.on-disable", null, true);
}
Also used : LanguageManager(com.github.sirblobman.api.language.LanguageManager) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager)

Example 28 with LanguageManager

use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.

the class CombatPlugin method getMessageWithPrefix.

@Override
public String getMessageWithPrefix(CommandSender sender, String key, Replacer replacer, boolean color) {
    LanguageManager languageManager = getLanguageManager();
    String message = languageManager.getMessage(sender, key, replacer, color);
    if (message.isEmpty()) {
        return "";
    }
    String prefix = languageManager.getMessage(sender, "prefix", null, true);
    if (prefix.isEmpty()) {
        return message;
    }
    if (!color)
        ChatColor.stripColor(prefix);
    return String.format(Locale.US, "%s %s", prefix, message);
}
Also used : LanguageManager(com.github.sirblobman.api.language.LanguageManager)

Example 29 with LanguageManager

use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.

the class CombatPlugin method onReload.

@Override
public void onReload() {
    ConfigurationManager configurationManager = getConfigurationManager();
    List<String> fileNameList = Arrays.asList("commands.yml", "config.yml", "punish.yml");
    for (String fileName : fileNameList) {
        configurationManager.reload(fileName);
    }
    LanguageManager languageManager = getLanguageManager();
    languageManager.reloadLanguages();
    IPunishManager punishManager = getPunishManager();
    punishManager.loadPunishments();
    ExpansionManager expansionManager = getExpansionManager();
    expansionManager.reloadConfigs();
}
Also used : IPunishManager(com.github.sirblobman.combatlogx.api.manager.IPunishManager) ExpansionManager(com.github.sirblobman.combatlogx.api.expansion.ExpansionManager) LanguageManager(com.github.sirblobman.api.language.LanguageManager) ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager)

Example 30 with LanguageManager

use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.

the class CombatPlugin method broadcastLoadMessage.

private void broadcastLoadMessage() {
    ConfigurationManager configurationManager = getConfigurationManager();
    YamlConfiguration configuration = configurationManager.get("config.yml");
    if (!configuration.getBoolean("broadcast.on-load")) {
        return;
    }
    LanguageManager languageManager = getLanguageManager();
    languageManager.broadcastMessage("broadcast.on-load", null, true);
}
Also used : LanguageManager(com.github.sirblobman.api.language.LanguageManager) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager)

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