Search in sources :

Example 1 with PlayerUntagEvent

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

the class CombatManager method untag.

@Override
public void untag(Player player, UntagReason untagReason) {
    Validate.notNull(player, "player must not be null!");
    Validate.notNull(untagReason, "untagReason must not be null!");
    if (!isInCombat(player))
        return;
    UUID uuid = player.getUniqueId();
    this.combatMap.remove(uuid);
    ITimerManager timerManager = this.plugin.getTimerManager();
    timerManager.remove(player);
    LivingEntity previousEnemy = this.enemyMap.remove(uuid);
    PlayerUntagEvent event = new PlayerUntagEvent(player, untagReason, previousEnemy);
    PluginManager pluginManager = Bukkit.getPluginManager();
    pluginManager.callEvent(event);
}
Also used : ITimerManager(com.github.sirblobman.combatlogx.api.manager.ITimerManager) LivingEntity(org.bukkit.entity.LivingEntity) PluginManager(org.bukkit.plugin.PluginManager) PlayerUntagEvent(com.github.sirblobman.combatlogx.api.event.PlayerUntagEvent) UUID(java.util.UUID)

Aggregations

PlayerUntagEvent (com.github.sirblobman.combatlogx.api.event.PlayerUntagEvent)1 ITimerManager (com.github.sirblobman.combatlogx.api.manager.ITimerManager)1 UUID (java.util.UUID)1 LivingEntity (org.bukkit.entity.LivingEntity)1 PluginManager (org.bukkit.plugin.PluginManager)1