use of com.github.sirblobman.combatlogx.api.manager.ICombatManager in project CombatLogX by SirBlobman.
the class RegionVulnerableListener method onDamage.
@EventHandler(priority = EventPriority.HIGHEST)
public void onDamage(EntityDamageByEntityEvent e) {
RegionHandler regionHandler = this.regionExpansion.getRegionHandler();
NoEntryMode noEntryMode = regionHandler.getNoEntryMode();
if (noEntryMode != NoEntryMode.VULNERABLE)
return;
Entity damaged = e.getEntity();
Player player = getPlayerOrPassenger(damaged);
if (player == null)
return;
if (isInCombat(player)) {
ICombatManager combatManager = getCombatManager();
LivingEntity enemy = combatManager.getEnemy(player);
TagType tagType = getTagType(enemy);
Location location = player.getLocation();
if (regionHandler.isSafeZone(player, location, tagType)) {
e.setCancelled(false);
}
}
}
use of com.github.sirblobman.combatlogx.api.manager.ICombatManager in project CombatLogX by SirBlobman.
the class PlaceholderHelper method getTimeLeftDecimal.
public static String getTimeLeftDecimal(ICombatLogX plugin, Player player) {
LanguageManager languageManager = plugin.getLanguageManager();
ICombatManager combatManager = plugin.getCombatManager();
double millisLeft = combatManager.getTimerLeftMillis(player);
if (millisLeft <= 0.0D)
return languageManager.getMessage(player, "placeholder.time-left-zero", null, true);
double secondsLeft = (millisLeft / 1_000.0D);
DecimalFormat decimalFormat = getDecimalFormat(plugin, player);
return decimalFormat.format(secondsLeft);
}
use of com.github.sirblobman.combatlogx.api.manager.ICombatManager in project CombatLogX by SirBlobman.
the class PlaceholderHelper method getEnemyHealthRounded.
public static String getEnemyHealthRounded(ICombatLogX plugin, Player player) {
ICombatManager combatManager = plugin.getCombatManager();
LivingEntity enemy = combatManager.getEnemy(player);
if (enemy == null)
return getUnknownEnemy(plugin, player);
double enemyHealth = enemy.getHealth();
long enemyHealthRounded = Math.round(enemyHealth);
return Long.toString(enemyHealthRounded);
}
use of com.github.sirblobman.combatlogx.api.manager.ICombatManager in project CombatLogX by SirBlobman.
the class PlaceholderHelper method getTimeLeft.
public static String getTimeLeft(ICombatLogX plugin, Player player) {
ICombatManager combatManager = plugin.getCombatManager();
int secondsLeft = combatManager.getTimerLeftSeconds(player);
if (secondsLeft > 0)
return Integer.toString(secondsLeft);
LanguageManager languageManager = plugin.getLanguageManager();
return languageManager.getMessage(player, "placeholder.time-left-zero", null, true);
}
use of com.github.sirblobman.combatlogx.api.manager.ICombatManager in project CombatLogX by SirBlobman.
the class PlaceholderHelper method getEnemyHeartsCount.
public static String getEnemyHeartsCount(ICombatLogX plugin, Player player) {
ICombatManager combatManager = plugin.getCombatManager();
LivingEntity enemy = combatManager.getEnemy(player);
if (enemy == null)
return getUnknownEnemy(plugin, player);
double enemyHealth = enemy.getHealth();
double enemyHearts = (enemyHealth / 2.0D);
long enemyHeartsRounded = Math.round(enemyHearts);
return Long.toString(enemyHeartsRounded);
}
Aggregations