Search in sources :

Example 1 with ScoreboardExpansion

use of combatlogx.expansion.scoreboard.ScoreboardExpansion in project CombatLogX by SirBlobman.

the class CustomScoreboardManager method isGlobalEnabled.

private boolean isGlobalEnabled() {
    ScoreboardExpansion expansion = getExpansion();
    ConfigurationManager configurationManager = expansion.getConfigurationManager();
    YamlConfiguration configuration = configurationManager.get("config.yml");
    return configuration.getBoolean("enabled", true);
}
Also used : YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) ScoreboardExpansion(combatlogx.expansion.scoreboard.ScoreboardExpansion) ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager)

Example 2 with ScoreboardExpansion

use of combatlogx.expansion.scoreboard.ScoreboardExpansion in project CombatLogX by SirBlobman.

the class CustomScoreboardManager method updateScoreboard.

public void updateScoreboard(Player player) {
    UUID uuid = player.getUniqueId();
    ScoreboardExpansion expansion = getExpansion();
    ScoreboardManager bukkitScoreboardManager = Bukkit.getScoreboardManager();
    if (bukkitScoreboardManager == null) {
        Logger logger = expansion.getLogger();
        logger.warning("The Bukkit scoreboard manager is not available yet!");
        return;
    }
    if (isDisabled(player)) {
        removeScoreboard(player);
        return;
    }
    CustomScoreboard customScoreboard = this.combatScoreboardMap.getOrDefault(uuid, null);
    if (customScoreboard == null) {
        createScoreboard(player);
        return;
    }
    customScoreboard.updateScoreboard();
}
Also used : CustomScoreboard(combatlogx.expansion.scoreboard.scoreboard.CustomScoreboard) ScoreboardManager(org.bukkit.scoreboard.ScoreboardManager) UUID(java.util.UUID) Logger(java.util.logging.Logger) ScoreboardExpansion(combatlogx.expansion.scoreboard.ScoreboardExpansion)

Example 3 with ScoreboardExpansion

use of combatlogx.expansion.scoreboard.ScoreboardExpansion in project CombatLogX by SirBlobman.

the class CustomScoreboardManager method enableScoreboard.

private CustomScoreboard enableScoreboard(Player player) {
    if (isDisabled(player)) {
        return null;
    }
    UUID uuid = player.getUniqueId();
    savePreviousScoreboard(player);
    ScoreboardExpansion expansion = getExpansion();
    CustomScoreboard customScoreboard = new CustomScoreboard(expansion, player);
    customScoreboard.enableScoreboard();
    this.combatScoreboardMap.put(uuid, customScoreboard);
    return customScoreboard;
}
Also used : CustomScoreboard(combatlogx.expansion.scoreboard.scoreboard.CustomScoreboard) UUID(java.util.UUID) ScoreboardExpansion(combatlogx.expansion.scoreboard.ScoreboardExpansion)

Example 4 with ScoreboardExpansion

use of combatlogx.expansion.scoreboard.ScoreboardExpansion in project CombatLogX by SirBlobman.

the class CustomScoreboardManager method shouldIgnorePrevious.

private boolean shouldIgnorePrevious() {
    ScoreboardExpansion expansion = getExpansion();
    ConfigurationManager configurationManager = expansion.getConfigurationManager();
    YamlConfiguration configuration = configurationManager.get("config.yml");
    return !configuration.getBoolean("save-previous");
}
Also used : YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) ScoreboardExpansion(combatlogx.expansion.scoreboard.ScoreboardExpansion) ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager)

Example 5 with ScoreboardExpansion

use of combatlogx.expansion.scoreboard.ScoreboardExpansion in project CombatLogX by SirBlobman.

the class CustomScoreboard method replacePlaceholders.

private String replacePlaceholders(String string) {
    ScoreboardExpansion expansion = getExpansion();
    ICombatLogX plugin = expansion.getPlugin();
    ICombatManager combatManager = plugin.getCombatManager();
    Player player = getPlayer();
    LivingEntity enemy = combatManager.getEnemy(player);
    String color = MessageUtility.color(string);
    return combatManager.replaceVariables(player, enemy, color);
}
Also used : LivingEntity(org.bukkit.entity.LivingEntity) Player(org.bukkit.entity.Player) ICombatManager(com.github.sirblobman.combatlogx.api.manager.ICombatManager) ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX) ScoreboardExpansion(combatlogx.expansion.scoreboard.ScoreboardExpansion)

Aggregations

ScoreboardExpansion (combatlogx.expansion.scoreboard.ScoreboardExpansion)5 ConfigurationManager (com.github.sirblobman.api.configuration.ConfigurationManager)2 CustomScoreboard (combatlogx.expansion.scoreboard.scoreboard.CustomScoreboard)2 UUID (java.util.UUID)2 YamlConfiguration (org.bukkit.configuration.file.YamlConfiguration)2 ICombatLogX (com.github.sirblobman.combatlogx.api.ICombatLogX)1 ICombatManager (com.github.sirblobman.combatlogx.api.manager.ICombatManager)1 Logger (java.util.logging.Logger)1 LivingEntity (org.bukkit.entity.LivingEntity)1 Player (org.bukkit.entity.Player)1 ScoreboardManager (org.bukkit.scoreboard.ScoreboardManager)1