Search in sources :

Example 56 with ICombatManager

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

the class ListenerCrackShot method onAttack.

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onAttack(WeaponDamageEntityEvent e) {
    Entity entity = e.getVictim();
    if (!(entity instanceof Player))
        return;
    Player damaged = (Player) entity;
    Player damager = e.getPlayer();
    ICombatManager combatManager = getCombatManager();
    combatManager.tag(damager, damaged, TagType.PLAYER, TagReason.ATTACKER);
    combatManager.tag(damaged, damager, TagType.PLAYER, TagReason.ATTACKED);
}
Also used : Entity(org.bukkit.entity.Entity) Player(org.bukkit.entity.Player) ICombatManager(com.github.sirblobman.combatlogx.api.manager.ICombatManager) EventHandler(org.bukkit.event.EventHandler)

Aggregations

ICombatManager (com.github.sirblobman.combatlogx.api.manager.ICombatManager)56 Player (org.bukkit.entity.Player)29 LivingEntity (org.bukkit.entity.LivingEntity)24 ICombatLogX (com.github.sirblobman.combatlogx.api.ICombatLogX)19 EventHandler (org.bukkit.event.EventHandler)9 Location (org.bukkit.Location)8 LanguageManager (com.github.sirblobman.api.language.LanguageManager)7 YamlConfiguration (org.bukkit.configuration.file.YamlConfiguration)7 ConfigurationManager (com.github.sirblobman.api.configuration.ConfigurationManager)5 TagType (com.github.sirblobman.combatlogx.api.object.TagType)5 Entity (org.bukkit.entity.Entity)5 Replacer (com.github.sirblobman.api.language.Replacer)4 DecimalFormat (java.text.DecimalFormat)4 Collections (java.util.Collections)4 List (java.util.List)4 Set (java.util.Set)4 OfflinePlayer (org.bukkit.OfflinePlayer)4 EntityType (org.bukkit.entity.EntityType)3 PacketContainer (com.comphenix.protocol.events.PacketContainer)2 EntityHandler (com.github.sirblobman.api.nms.EntityHandler)2