use of com.github.sirblobman.combatlogx.api.manager.ICombatManager in project CombatLogX by SirBlobman.
the class PlaceholderHelper method getEnemyLocation.
@Nullable
public static Location getEnemyLocation(ICombatLogX plugin, Player player) {
ICombatManager combatManager = plugin.getCombatManager();
LivingEntity enemy = combatManager.getEnemy(player);
return (enemy == null ? null : enemy.getLocation());
}
use of com.github.sirblobman.combatlogx.api.manager.ICombatManager in project CombatLogX by SirBlobman.
the class PlaceholderHelper method getEnemyDisplayName.
public static String getEnemyDisplayName(ICombatLogX plugin, Player player) {
ICombatManager combatManager = plugin.getCombatManager();
LivingEntity enemy = combatManager.getEnemy(player);
if (enemy instanceof Player) {
Player enemyPlayer = (Player) enemy;
return enemyPlayer.getDisplayName();
}
return getEnemyName(plugin, player);
}
use of com.github.sirblobman.combatlogx.api.manager.ICombatManager in project CombatLogX by SirBlobman.
the class PlaceholderHelper method getEnemyHearts.
public static String getEnemyHearts(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);
if (enemyHeartsRounded > 10L) {
return Long.toString(enemyHeartsRounded);
}
char heartSymbol = '\u2764';
char[] charArray = new char[(int) enemyHeartsRounded];
Arrays.fill(charArray, heartSymbol);
String hearts = new String(charArray);
return MessageUtility.color("&4" + hearts);
}
use of com.github.sirblobman.combatlogx.api.manager.ICombatManager in project CombatLogX by SirBlobman.
the class PlaceholderHelper method getStatus.
public static String getStatus(ICombatLogX plugin, Player player) {
ICombatManager combatManager = plugin.getCombatManager();
LanguageManager languageManager = plugin.getLanguageManager();
boolean inCombat = combatManager.isInCombat(player);
String key = ("placeholder.status." + (inCombat ? "fighting" : "idle"));
return languageManager.getMessage(player, key, null, true);
}
use of com.github.sirblobman.combatlogx.api.manager.ICombatManager in project CombatLogX by SirBlobman.
the class PlaceholderHelper method getEnemyHealth.
public static String getEnemyHealth(ICombatLogX plugin, Player player) {
ICombatManager combatManager = plugin.getCombatManager();
LivingEntity enemy = combatManager.getEnemy(player);
if (enemy == null)
return getUnknownEnemy(plugin, player);
double enemyHealth = enemy.getHealth();
DecimalFormat decimalFormat = getDecimalFormat(plugin, player);
return decimalFormat.format(enemyHealth);
}
Aggregations