Search in sources :

Example 6 with UntagReason

use of com.github.sirblobman.combatlogx.api.object.UntagReason in project CombatLogX by SirBlobman.

the class ListenerUntag method onUntag.

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onUntag(PlayerUntagEvent e) {
    Player player = e.getPlayer();
    LivingEntity previousEnemy = e.getPreviousEnemy();
    UntagReason untagReason = e.getUntagReason();
    ICombatLogX plugin = getCombatLogX();
    IPunishManager punishManager = plugin.getPunishManager();
    punishManager.punish(player, untagReason, previousEnemy);
    sendUntagMessage(player, untagReason);
    runUntagCommands(player, previousEnemy);
}
Also used : LivingEntity(org.bukkit.entity.LivingEntity) IPunishManager(com.github.sirblobman.combatlogx.api.manager.IPunishManager) Player(org.bukkit.entity.Player) ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX) UntagReason(com.github.sirblobman.combatlogx.api.object.UntagReason) EventHandler(org.bukkit.event.EventHandler)

Example 7 with UntagReason

use of com.github.sirblobman.combatlogx.api.object.UntagReason in project CombatLogX by SirBlobman.

the class ListenerLogger method onUntag.

@EventHandler(priority = EventPriority.MONITOR)
public void onUntag(PlayerUntagEvent e) {
    if (isDisabled("log-untag"))
        return;
    Player player = e.getPlayer();
    LivingEntity enemy = e.getPreviousEnemy();
    UntagReason untagReason = e.getUntagReason();
    boolean isExpire = untagReason.isExpire();
    String format = getLoggerFormat("untag-format");
    String playerName = player.getName();
    String enemyName = getEntityName(enemy);
    String untagReasonName = untagReason.name();
    String expireString = Boolean.toString(isExpire);
    String message = format.replace("{player}", playerName).replace("{enemy}", enemyName).replace("{untag_reason}", untagReasonName).replace("{was_expire}", expireString);
    appendLog(message);
}
Also used : LivingEntity(org.bukkit.entity.LivingEntity) Player(org.bukkit.entity.Player) UntagReason(com.github.sirblobman.combatlogx.api.object.UntagReason) EventHandler(org.bukkit.event.EventHandler)

Aggregations

UntagReason (com.github.sirblobman.combatlogx.api.object.UntagReason)7 EventHandler (org.bukkit.event.EventHandler)7 Player (org.bukkit.entity.Player)6 LivingEntity (org.bukkit.entity.LivingEntity)4 ICombatLogX (com.github.sirblobman.combatlogx.api.ICombatLogX)1 ICombatManager (com.github.sirblobman.combatlogx.api.manager.ICombatManager)1 IPunishManager (com.github.sirblobman.combatlogx.api.manager.IPunishManager)1 UUID (java.util.UUID)1