use of com.github.sirblobman.combatlogx.api.object.UntagReason in project CombatLogX by SirBlobman.
the class ListenerLootProtection method onUntag.
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onUntag(PlayerUntagEvent e) {
LivingEntity previousEnemy = e.getPreviousEnemy();
if (previousEnemy == null)
return;
Player player = e.getPlayer();
UUID playerId = player.getUniqueId();
UUID previousEnemyId = previousEnemy.getUniqueId();
UntagReason untagReason = e.getUntagReason();
if (untagReason == UntagReason.SELF_DEATH) {
this.enemyMap.put(playerId, previousEnemyId);
}
if (untagReason == UntagReason.ENEMY_DEATH) {
this.enemyMap.put(previousEnemyId, playerId);
}
}
use of com.github.sirblobman.combatlogx.api.object.UntagReason in project CombatLogX by SirBlobman.
the class ListenerLogger method onPunish.
@EventHandler(priority = EventPriority.MONITOR)
public void onPunish(PlayerPunishEvent e) {
if (isDisabled("log-punish"))
return;
Player player = e.getPlayer();
LivingEntity enemy = e.getPreviousEnemy();
UntagReason untagReason = e.getPunishReason();
String format = getLoggerFormat("untag-format");
String playerName = player.getName();
String enemyName = getEntityName(enemy);
String untagReasonName = untagReason.name();
String cancelledString = Boolean.toString(e.isCancelled());
String message = format.replace("{player}", playerName).replace("{enemy}", enemyName).replace("{punish_reason}", untagReasonName).replace("{was_cancelled}", cancelledString);
appendLog(message);
}
use of com.github.sirblobman.combatlogx.api.object.UntagReason in project CombatLogX by SirBlobman.
the class ListenerPunish method beforePunish.
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void beforePunish(PlayerPunishEvent e) {
UntagReason untagReason = e.getPunishReason();
if (shouldPunishForReason(untagReason)) {
return;
}
e.setCancelled(true);
}
use of com.github.sirblobman.combatlogx.api.object.UntagReason in project CombatLogX by SirBlobman.
the class ListenerUntag method onKick.
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onKick(PlayerKickEvent e) {
Player player = e.getPlayer();
if (!isInCombat(player)) {
return;
}
String kickReason = e.getReason();
UntagReason untagReason = (isKickReasonIgnored(kickReason) ? UntagReason.EXPIRE : UntagReason.KICK);
ICombatManager combatManager = getCombatManager();
combatManager.untag(player, untagReason);
}
use of com.github.sirblobman.combatlogx.api.object.UntagReason in project CombatLogX by SirBlobman.
the class ListenerCommands method onUntag.
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onUntag(PlayerUntagEvent e) {
UntagReason untagReason = e.getUntagReason();
if (!untagReason.isExpire())
return;
Player player = e.getPlayer();
addCooldown(player);
}
Aggregations