Search in sources :

Example 6 with ICombatLogX

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

the class uSkyBlockExpansion method onEnable.

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

Example 7 with ICombatLogX

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

the class ListenerDamage method onDamage.

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onDamage(EntityDamageEvent e) {
    Entity entity = e.getEntity();
    if (!(entity instanceof Player))
        return;
    if (checkDamageByEntity(e))
        return;
    Player player = (Player) entity;
    DamageCause damageCause = e.getCause();
    if (isDisabled(damageCause))
        return;
    ICombatLogX combatLogX = getCombatLogX();
    ICombatManager combatManager = combatLogX.getCombatManager();
    boolean wasInCombat = combatManager.isInCombat(player);
    boolean tagged = combatManager.tag(player, null, TagType.UNKNOWN, TagReason.UNKNOWN);
    if (tagged && !wasInCombat)
        sendMessage(player, damageCause);
}
Also used : Entity(org.bukkit.entity.Entity) 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) DamageCause(org.bukkit.event.entity.EntityDamageEvent.DamageCause) EventHandler(org.bukkit.event.EventHandler)

Example 8 with ICombatLogX

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

the class ListenerDeathEffects method onDeath.

@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onDeath(PlayerDeathEvent e) {
    YamlConfiguration configuration = getConfiguration();
    List<String> enabledDeathEffectList = configuration.getStringList("death-effect-list");
    if (enabledDeathEffectList.isEmpty())
        return;
    Player player = e.getEntity();
    boolean requireCombatDeath = configuration.getBoolean("combat-death-only");
    if (requireCombatDeath) {
        ICombatLogX combatLogX = getCombatLogX();
        IDeathListener deathListener = combatLogX.getDeathListener();
        if (!deathListener.contains(player))
            return;
    }
    if (enabledDeathEffectList.contains("BLOOD")) {
        playBloodEffect(player);
    }
    if (enabledDeathEffectList.contains("LIGHTNING")) {
        playLightningEffect(player);
    }
}
Also used : Player(org.bukkit.entity.Player) ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX) IDeathListener(com.github.sirblobman.combatlogx.api.listener.IDeathListener) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) EventHandler(org.bukkit.event.EventHandler)

Example 9 with ICombatLogX

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

the class HookPlaceholderAPI method getDescriptionFile.

private PluginDescriptionFile getDescriptionFile() {
    ICombatLogX combatLogX = this.expansion.getPlugin();
    JavaPlugin plugin = combatLogX.getPlugin();
    return plugin.getDescription();
}
Also used : JavaPlugin(org.bukkit.plugin.java.JavaPlugin) ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX)

Example 10 with ICombatLogX

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

the class PlaceholderAPIExpansion method onEnable.

@Override
public void onEnable() {
    if (!checkDependency("PlaceholderAPI", true)) {
        ICombatLogX plugin = getPlugin();
        ExpansionManager expansionManager = plugin.getExpansionManager();
        expansionManager.disableExpansion(this);
        return;
    }
    HookPlaceholderAPI hook = new HookPlaceholderAPI(this);
    hook.register();
}
Also used : ExpansionManager(com.github.sirblobman.combatlogx.api.expansion.ExpansionManager) 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