use of com.github.sirblobman.combatlogx.api.manager.ICombatManager in project CombatLogX by SirBlobman.
the class CombatPlugin method untagAllPlayers.
private void untagAllPlayers() {
ICombatManager combatManager = getCombatManager();
List<Player> playerCombatList = combatManager.getPlayersInCombat();
for (Player player : playerCombatList) {
combatManager.untag(player, UntagReason.EXPIRE);
}
}
use of com.github.sirblobman.combatlogx.api.manager.ICombatManager in project CombatLogX by SirBlobman.
the class ListenerConfiguration method checkDeathUntag.
private void checkDeathUntag(Player player) {
ConfigurationManager configurationManager = getPluginConfigurationManager();
YamlConfiguration configuration = configurationManager.get("config.yml");
if (!configuration.getBoolean("untag-on-death"))
return;
ICombatManager combatManager = getCombatManager();
if (combatManager.isInCombat(player)) {
combatManager.untag(player, UntagReason.SELF_DEATH);
}
}
use of com.github.sirblobman.combatlogx.api.manager.ICombatManager in project CombatLogX by SirBlobman.
the class ListenerConfiguration method checkEnemyDeathUntag.
private void checkEnemyDeathUntag(LivingEntity enemy) {
ConfigurationManager configurationManager = getPluginConfigurationManager();
YamlConfiguration configuration = configurationManager.get("config.yml");
if (!configuration.getBoolean("untag-on-enemy-death"))
return;
ICombatManager combatManager = getCombatManager();
OfflinePlayer offlinePlayer = combatManager.getByEnemy(enemy);
if (offlinePlayer == null || !offlinePlayer.isOnline())
return;
Player player = offlinePlayer.getPlayer();
if (player != null && combatManager.isInCombat(player))
combatManager.untag(player, UntagReason.ENEMY_DEATH);
}
use of com.github.sirblobman.combatlogx.api.manager.ICombatManager in project CombatLogX by SirBlobman.
the class CommandCombatTimer method checkSelf.
private void checkSelf(Player player) {
ICombatLogX plugin = getCombatLogX();
ICombatManager combatManager = plugin.getCombatManager();
LanguageManager languageManager = getLanguageManager();
if (combatManager.isInCombat(player)) {
double timeLeftMillis = combatManager.getTimerLeftMillis(player);
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-self", replacer, true);
return;
}
sendMessageWithPrefix(player, "error.self-not-in-combat", null, true);
}
use of com.github.sirblobman.combatlogx.api.manager.ICombatManager in project CombatLogX by SirBlobman.
the class TimerUpdateTask method run.
@Override
public void run() {
ICombatManager combatManager = this.plugin.getCombatManager();
List<Player> playerCombatList = combatManager.getPlayersInCombat();
playerCombatList.forEach(this::update);
}
Aggregations