Search in sources :

Example 1 with ICombatLogX

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

the class LootProtectionExpansion method onEnable.

@Override
public void onEnable() {
    int minorVersion = VersionUtility.getMinorVersion();
    if (minorVersion < 16) {
        Logger logger = getLogger();
        logger.info("The loot protection expansion requires Spigot 1.16.5 or higher.");
        ICombatLogX plugin = getPlugin();
        ExpansionManager expansionManager = plugin.getExpansionManager();
        expansionManager.disableExpansion(this);
        return;
    }
    new ListenerLootProtection(this).register();
}
Also used : ExpansionManager(com.github.sirblobman.combatlogx.api.expansion.ExpansionManager) ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX) Logger(java.util.logging.Logger) ListenerLootProtection(combatlogx.expansion.loot.protection.listener.ListenerLootProtection)

Example 2 with ICombatLogX

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

the class ListenerDamage method getDamager.

private Entity getDamager(EntityDamageByEntityEvent e) {
    ConfigurationManager configurationManager = getPluginConfigurationManager();
    YamlConfiguration configuration = configurationManager.get("config.yml");
    Entity damager = e.getDamager();
    if (configuration.getBoolean("link-projectiles")) {
        ICombatLogX plugin = getCombatLogX();
        damager = EntityHelper.linkProjectile(plugin, damager);
    }
    if (configuration.getBoolean("link-pets")) {
        damager = EntityHelper.linkPet(damager);
    }
    return damager;
}
Also used : Entity(org.bukkit.entity.Entity) ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager)

Example 3 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 4 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 5 with ICombatLogX

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

the class GlowingExpansion method onEnable.

@Override
public void onEnable() {
    Logger logger = getLogger();
    ICombatLogX plugin = getPlugin();
    ExpansionManager expansionManager = plugin.getExpansionManager();
    int minorVersion = VersionUtility.getMinorVersion();
    if (minorVersion < 9) {
        logger.warning("This expansion is made for 1.9+");
        expansionManager.disableExpansion(this);
        return;
    }
    new ListenerGlow(this).register();
}
Also used : ListenerGlow(combatlogx.expansion.glowing.listener.ListenerGlow) ExpansionManager(com.github.sirblobman.combatlogx.api.expansion.ExpansionManager) ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX) Logger(java.util.logging.Logger)

Aggregations

ICombatLogX (com.github.sirblobman.combatlogx.api.ICombatLogX)93 ExpansionManager (com.github.sirblobman.combatlogx.api.expansion.ExpansionManager)22 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 List (java.util.List)8 Replacer (com.github.sirblobman.api.language.Replacer)6 Expansion (com.github.sirblobman.combatlogx.api.expansion.Expansion)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 Set (java.util.Set)4