use of com.github.sirblobman.combatlogx.api.object.TagType in project CombatLogX by SirBlobman.
the class ListenerDamage method beforeTag.
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void beforeTag(PlayerPreTagEvent e) {
TagType tagType = e.getTagType();
if (tagType != TagType.MOB) {
return;
}
LivingEntity enemy = e.getEnemy();
if (enemy == null || enemy instanceof Player) {
return;
}
EntityType entityType = enemy.getType();
if (isDisabled(entityType)) {
e.setCancelled(true);
return;
}
SpawnReason spawnReason = getSpawnReason(enemy);
if (isDisabled(spawnReason)) {
e.setCancelled(true);
}
}
use of com.github.sirblobman.combatlogx.api.object.TagType in project CombatLogX by SirBlobman.
the class ListenerForceField method isSafe.
protected boolean isSafe(Player player, Location location) {
ICombatManager combatManager = getCombatManager();
LivingEntity enemy = combatManager.getEnemy(player);
TagType tagType = getTagType(enemy);
return isSafe(player, location, tagType);
}
use of com.github.sirblobman.combatlogx.api.object.TagType in project CombatLogX by SirBlobman.
the class ListenerLogger method beforeTag.
@EventHandler(priority = EventPriority.MONITOR)
public void beforeTag(PlayerPreTagEvent e) {
if (isDisabled("log-pretag"))
return;
Player player = e.getPlayer();
LivingEntity enemy = e.getEnemy();
TagReason tagReason = e.getTagReason();
TagType tagType = e.getTagType();
String format = getLoggerFormat("pretag-format");
String playerName = player.getName();
String enemyName = getEntityName(enemy);
String tagReasonName = tagReason.name();
String tagTypeName = tagType.name();
String cancelledString = Boolean.toString(e.isCancelled());
String message = format.replace("{player}", playerName).replace("{enemy}", enemyName).replace("{tag_reason}", tagReasonName).replace("{tag_type}", tagTypeName).replace("{was_cancelled}", cancelledString);
appendLog(message);
}
use of com.github.sirblobman.combatlogx.api.object.TagType in project CombatLogX by SirBlobman.
the class ListenerLogger method onTag.
@EventHandler(priority = EventPriority.MONITOR)
public void onTag(PlayerTagEvent e) {
if (isDisabled("log-tag"))
return;
Player player = e.getPlayer();
LivingEntity enemy = e.getEnemy();
TagReason tagReason = e.getTagReason();
TagType tagType = e.getTagType();
String format = getLoggerFormat("tag-format");
String playerName = player.getName();
String enemyName = getEntityName(enemy);
String tagReasonName = tagReason.name();
String tagTypeName = tagType.name();
String message = format.replace("{player}", playerName).replace("{enemy}", enemyName).replace("{tag_reason}", tagReasonName).replace("{tag_type}", tagTypeName);
appendLog(message);
}
use of com.github.sirblobman.combatlogx.api.object.TagType in project CombatLogX by SirBlobman.
the class ListenerMythicMobs method beforeTag.
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void beforeTag(PlayerPreTagEvent e) {
TagType tagType = e.getTagType();
if (tagType != TagType.MYTHIC_MOB) {
return;
}
LivingEntity enemy = e.getEnemy();
if (enemy == null || !isMythicMob(enemy)) {
return;
}
String mobName = getMythicMobName(enemy);
if (isNoTag(mobName)) {
e.setCancelled(true);
}
}
Aggregations