use of com.github.sirblobman.combatlogx.api.manager.ICombatManager in project CombatLogX by SirBlobman.
the class UntagTask method run.
@Override
public void run() {
ICombatManager combatManager = this.plugin.getCombatManager();
List<Player> playerCombatList = combatManager.getPlayersInCombat();
for (Player player : playerCombatList) {
long timeLeftMillis = combatManager.getTimerLeftMillis(player);
if (timeLeftMillis > 0) {
continue;
}
combatManager.untag(player, UntagReason.EXPIRE);
}
}
use of com.github.sirblobman.combatlogx.api.manager.ICombatManager in project CombatLogX by SirBlobman.
the class CommandCombatTimer method checkOther.
private void checkOther(Player player, Player target) {
ICombatLogX plugin = getCombatLogX();
ICombatManager combatManager = plugin.getCombatManager();
LanguageManager languageManager = getLanguageManager();
if (combatManager.isInCombat(target)) {
double timeLeftMillis = combatManager.getTimerLeftMillis(target);
double timeLeftSeconds = (timeLeftMillis / 1_000.0D);
String decimalFormatString = languageManager.getMessage(player, "decimal-format", null, false);
DecimalFormat decimalFormat = new DecimalFormat(decimalFormatString);
String timeLeftString = decimalFormat.format(timeLeftSeconds);
Replacer replacer = message -> message.replace("{time_left}", timeLeftString);
sendMessageWithPrefix(player, "command.combat-timer.time-left-other", replacer, true);
return;
}
sendMessageWithPrefix(player, "error.target-not-in-combat", null, true);
}
use of com.github.sirblobman.combatlogx.api.manager.ICombatManager in project CombatLogX by SirBlobman.
the class ListenerDamage method checkTag.
private void checkTag(Entity entity, Entity enemy, TagReason tagReason) {
if (!(entity instanceof Player)) {
return;
}
Player player = (Player) entity;
if (hasBypassPermission(player)) {
return;
}
if (!(enemy instanceof LivingEntity)) {
return;
}
LivingEntity livingEnemy = (LivingEntity) enemy;
EntityType enemyType = livingEnemy.getType();
if (isDisabled(enemyType)) {
return;
}
SpawnReason spawnReason = getSpawnReason(livingEnemy);
if (isDisabled(spawnReason)) {
return;
}
ICombatLogX plugin = getCombatLogX();
ICombatManager combatManager = plugin.getCombatManager();
combatManager.tag(player, livingEnemy, TagType.MOB, tagReason);
}
use of com.github.sirblobman.combatlogx.api.manager.ICombatManager in project CombatLogX by SirBlobman.
the class HookPlaceholderAPI method getEnemyPlaceholder.
private String getEnemyPlaceholder(Player player, String enemyPlaceholder) {
ICombatLogX plugin = this.expansion.getPlugin();
ICombatManager combatManager = plugin.getCombatManager();
LivingEntity enemy = combatManager.getEnemy(player);
if (enemy instanceof Player) {
Player playerEnemy = (Player) enemy;
String placeholder = String.format(Locale.US, "{%s}", enemyPlaceholder);
return PlaceholderAPI.setBracketPlaceholders(playerEnemy, placeholder);
}
return getUnknownEnemy(plugin, player);
}
use of com.github.sirblobman.combatlogx.api.manager.ICombatManager in project CombatLogX by SirBlobman.
the class ListenerForceField method isSafeSurround.
protected boolean isSafeSurround(Player player, Location location) {
ICombatManager combatManager = getCombatManager();
LivingEntity enemy = combatManager.getEnemy(player);
TagType tagType = getTagType(enemy);
return isSafeSurround(player, location, tagType);
}
Aggregations