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();
}
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;
}
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);
}
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);
}
}
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();
}
Aggregations