Search in sources :

Example 76 with ICombatLogX

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

the class HookPlaceholderAPI method getNewbieHelper.

private Expansion getNewbieHelper() {
    ICombatLogX plugin = this.expansion.getPlugin();
    ExpansionManager expansionManager = plugin.getExpansionManager();
    Optional<Expansion> optionalExpansion = expansionManager.getExpansion("NewbieHelper");
    if (optionalExpansion.isPresent()) {
        Expansion expansion = optionalExpansion.get();
        State state = expansion.getState();
        if (state == State.ENABLED)
            return expansion;
    }
    return null;
}
Also used : ExpansionManager(com.github.sirblobman.combatlogx.api.expansion.ExpansionManager) State(com.github.sirblobman.combatlogx.api.expansion.Expansion.State) ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX) NewbieHelperExpansion(combatlogx.expansion.newbie.helper.NewbieHelperExpansion) PlaceholderExpansion(me.clip.placeholderapi.expansion.PlaceholderExpansion) Expansion(com.github.sirblobman.combatlogx.api.expansion.Expansion)

Example 77 with ICombatLogX

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

the class HookPlaceholderAPI method getNewbieHelperPVPStatus.

private String getNewbieHelperPVPStatus(Player player) {
    ICombatLogX plugin = this.expansion.getPlugin();
    LanguageManager languageManager = plugin.getLanguageManager();
    boolean pvp = true;
    Expansion expansion = getNewbieHelper();
    if (expansion != null) {
        NewbieHelperExpansion newbieHelperExpansion = (NewbieHelperExpansion) expansion;
        PVPManager pvpManager = newbieHelperExpansion.getPVPManager();
        pvp = !pvpManager.isDisabled(player);
    }
    String messagePath = ("placeholder.pvp-status." + (pvp ? "enabled" : "disabled"));
    return languageManager.getMessage(player, messagePath, null, true);
}
Also used : NewbieHelperExpansion(combatlogx.expansion.newbie.helper.NewbieHelperExpansion) PVPManager(combatlogx.expansion.newbie.helper.manager.PVPManager) LanguageManager(com.github.sirblobman.api.language.LanguageManager) ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX) NewbieHelperExpansion(combatlogx.expansion.newbie.helper.NewbieHelperExpansion) PlaceholderExpansion(me.clip.placeholderapi.expansion.PlaceholderExpansion) Expansion(com.github.sirblobman.combatlogx.api.expansion.Expansion)

Example 78 with ICombatLogX

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

the class HookPlaceholderAPI method getEnemyPlaceholder.

private String getEnemyPlaceholder(Player player, String enemyPlaceholder) {
    ICombatLogX plugin = this.expansion.getPlugin();
    ICombatManager combatManager = plugin.getCombatManager();
    LivingEntity enemy = combatManager.getEnemy(player);
    if (enemy instanceof Player) {
        Player playerEnemy = (Player) enemy;
        String placeholder = String.format(Locale.US, "{%s}", enemyPlaceholder);
        return PlaceholderAPI.setBracketPlaceholders(playerEnemy, placeholder);
    }
    return getUnknownEnemy(plugin, player);
}
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)

Example 79 with ICombatLogX

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

the class SuperiorSkyblockExpansion method onEnable.

@Override
public void onEnable() {
    if (!checkDependency("SuperiorSkyblock2", true)) {
        ICombatLogX plugin = getPlugin();
        ExpansionManager expansionManager = plugin.getExpansionManager();
        expansionManager.disableExpansion(this);
        return;
    }
    new ListenerSuperiorSkyblock(this).register();
}
Also used : ExpansionManager(com.github.sirblobman.combatlogx.api.expansion.ExpansionManager) ListenerSuperiorSkyblock(combatlogx.expansion.compatibility.superior.skyblock.listener.ListenerSuperiorSkyblock) ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX)

Example 80 with ICombatLogX

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

the class PVPManager method isDisabled.

public boolean isDisabled(Player player) {
    Validate.notNull(player, "player must not be null!");
    if (player.hasMetadata("NPC")) {
        return false;
    }
    ConfigurationManager configurationManager = this.expansion.getConfigurationManager();
    YamlConfiguration configuration = configurationManager.get("config.yml");
    boolean defaultPvpState = configuration.getBoolean("pvp-toggle-default-status", true);
    ICombatLogX plugin = this.expansion.getPlugin();
    PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
    YamlConfiguration playerData = playerDataManager.get(player);
    return !playerData.getBoolean("newbie-helper.pvp-toggle", defaultPvpState);
}
Also used : ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager) PlayerDataManager(com.github.sirblobman.api.configuration.PlayerDataManager)

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