Search in sources :

Example 21 with ICombatLogX

use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.

the class ListenerUntag method isKickReasonIgnored.

private boolean isKickReasonIgnored(String kickReason) {
    ICombatLogX plugin = getCombatLogX();
    ConfigurationManager configurationManager = plugin.getConfigurationManager();
    YamlConfiguration configuration = configurationManager.get("punish.yml");
    List<String> kickIgnoreList = configuration.getStringList("kick-ignore-list");
    if (kickIgnoreList.isEmpty()) {
        return false;
    }
    for (String kickIgnoreMessage : kickIgnoreList) {
        if (kickReason.contains(kickIgnoreMessage)) {
            return true;
        }
    }
    return false;
}
Also used : ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager)

Example 22 with ICombatLogX

use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.

the class ListenerUntag method sendUntagMessage.

private void sendUntagMessage(Player player, UntagReason untagReason) {
    if (!untagReason.isExpire()) {
        return;
    }
    ICombatLogX plugin = getCombatLogX();
    String languagePath = ("combat-timer." + (untagReason == UntagReason.EXPIRE ? "expire" : "enemy-death"));
    plugin.sendMessageWithPrefix(player, languagePath, null, true);
}
Also used : ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX)

Example 23 with ICombatLogX

use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.

the class CustomScoreboard method createObjective.

private void createObjective() {
    Player player = getPlayer();
    LanguageManager languageManager = getLanguageManager();
    String title = languageManager.getMessage(player, "expansion.scoreboard.title", null, true);
    String titleReplaced = replacePlaceholders(title);
    ICombatLogX plugin = this.expansion.getPlugin();
    MultiVersionHandler multiVersionHandler = plugin.getMultiVersionHandler();
    ScoreboardHandler scoreboardHandler = multiVersionHandler.getScoreboardHandler();
    Scoreboard scoreboard = getScoreboard();
    this.objective = scoreboardHandler.createObjective(scoreboard, "combatlogx", "dummy", titleReplaced);
    this.objective.setDisplaySlot(DisplaySlot.SIDEBAR);
}
Also used : Player(org.bukkit.entity.Player) MultiVersionHandler(com.github.sirblobman.api.nms.MultiVersionHandler) ScoreboardHandler(com.github.sirblobman.api.nms.scoreboard.ScoreboardHandler) Scoreboard(org.bukkit.scoreboard.Scoreboard) LanguageManager(com.github.sirblobman.api.language.LanguageManager) ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX)

Example 24 with ICombatLogX

use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.

the class CommandCombatTimer method checkSelf.

private void checkSelf(Player player) {
    ICombatLogX plugin = getCombatLogX();
    ICombatManager combatManager = plugin.getCombatManager();
    LanguageManager languageManager = getLanguageManager();
    if (combatManager.isInCombat(player)) {
        double timeLeftMillis = combatManager.getTimerLeftMillis(player);
        double timeLeftSeconds = (timeLeftMillis / 1_000.0D);
        String decimalFormatString = languageManager.getMessage(player, "decimal-format", null, false);
        DecimalFormat decimalFormat = new DecimalFormat(decimalFormatString);
        String timeLeftString = decimalFormat.format(timeLeftSeconds);
        Replacer replacer = message -> message.replace("{time_left}", timeLeftString);
        sendMessageWithPrefix(player, "command.combat-timer.time-left-self", replacer, true);
        return;
    }
    sendMessageWithPrefix(player, "error.self-not-in-combat", null, true);
}
Also used : List(java.util.List) Replacer(com.github.sirblobman.api.language.Replacer) DecimalFormat(java.text.DecimalFormat) LanguageManager(com.github.sirblobman.api.language.LanguageManager) Set(java.util.Set) CombatLogPlayerCommand(com.github.sirblobman.combatlogx.api.command.CombatLogPlayerCommand) Player(org.bukkit.entity.Player) ICombatManager(com.github.sirblobman.combatlogx.api.manager.ICombatManager) Collections(java.util.Collections) ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX) ICombatManager(com.github.sirblobman.combatlogx.api.manager.ICombatManager) DecimalFormat(java.text.DecimalFormat) LanguageManager(com.github.sirblobman.api.language.LanguageManager) ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX) Replacer(com.github.sirblobman.api.language.Replacer)

Example 25 with ICombatLogX

use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.

the class CommandCombatLogXReload method execute.

@Override
protected boolean execute(CommandSender sender, String[] args) {
    if (!checkPermission(sender, "combatlogx.command.combatlogx.reload", true)) {
        return true;
    }
    ICombatLogX plugin = getCombatLogX();
    plugin.onReload();
    sendMessageWithPrefix(sender, "command.combatlogx.reload-success", null, true);
    return true;
}
Also used : ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX)

Aggregations

ICombatLogX (com.github.sirblobman.combatlogx.api.ICombatLogX)96 ExpansionManager (com.github.sirblobman.combatlogx.api.expansion.ExpansionManager)24 ICombatManager (com.github.sirblobman.combatlogx.api.manager.ICombatManager)19 YamlConfiguration (org.bukkit.configuration.file.YamlConfiguration)19 Player (org.bukkit.entity.Player)18 JavaPlugin (org.bukkit.plugin.java.JavaPlugin)14 LivingEntity (org.bukkit.entity.LivingEntity)13 LanguageManager (com.github.sirblobman.api.language.LanguageManager)12 Logger (java.util.logging.Logger)11 ConfigurationManager (com.github.sirblobman.api.configuration.ConfigurationManager)10 MultiVersionHandler (com.github.sirblobman.api.nms.MultiVersionHandler)9 PlayerDataManager (com.github.sirblobman.api.configuration.PlayerDataManager)8 Expansion (com.github.sirblobman.combatlogx.api.expansion.Expansion)8 List (java.util.List)8 Replacer (com.github.sirblobman.api.language.Replacer)6 EntityHandler (com.github.sirblobman.api.nms.EntityHandler)5 State (com.github.sirblobman.combatlogx.api.expansion.Expansion.State)5 Collections (java.util.Collections)5 EventHandler (org.bukkit.event.EventHandler)5 NewbieHelperExpansion (combatlogx.expansion.newbie.helper.NewbieHelperExpansion)4