use of com.SirBlobman.combatlogx.event.PlayerTagEvent.TagReason in project MyPet by xXKeyleXx.
the class CombatLogXHook method on.
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void on(EntityDamageByEntityEvent e) {
Entity damaged = e.getEntity();
Entity damager = e.getDamager();
if ((damager instanceof CraftMyPetProjectile) && (ConfigOptions.OPTION_LINK_PROJECTILES || IGNORE_PLUGIN_SETTINGS)) {
damager = ((CraftMyPetProjectile) damager).getShootingMyPet();
}
if ((damager instanceof MyPetBukkitEntity) && (ConfigOptions.OPTION_LINK_PETS || IGNORE_PLUGIN_SETTINGS)) {
damager = ((MyPetBukkitEntity) damager).getOwner().getPlayer();
} else {
return;
}
if (damager != null && damaged instanceof LivingEntity) {
if (damaged instanceof Player) {
Player p = (Player) damaged;
LivingEntity enemy = (LivingEntity) damager;
TagReason reason = TagReason.ATTACKED;
CombatUtil.tag(p, enemy, TagType.PLAYER, reason);
}
Player p = (Player) damager;
LivingEntity enemy = (LivingEntity) damaged;
TagType type = damaged instanceof Player ? TagType.PLAYER : TagType.MOB;
TagReason reason = TagReason.ATTACKER;
CombatUtil.tag(p, enemy, type, reason);
}
}
Aggregations