use of com.palmergames.adventure.bossbar.BossBar in project SiegeWar by TownyAdvanced.
the class BossBarUtil method updateBattleSessionBossBar.
public static void updateBattleSessionBossBar() {
BattleSession session = BattleSession.getBattleSession();
TextComponent comp = Component.text(Translation.of("bossbar_msg_battle_time_remaining", session.getFormattedTimeRemainingUntilBattleSessionEnds()));
float remaining = getRemainder(session.getScheduledEndTime(), SiegeWarSettings.getWarSiegeBattleSessionsDurationMinutes() * 60000);
for (Player player : Bukkit.getOnlinePlayers()) {
Resident resident = TownyAPI.getInstance().getResident(player);
if (resident == null || ResidentMetaDataController.getBossBarsDisabled(resident))
continue;
BossBar bossBar = bossBarBattleSessionMap.containsKey(player) ? bossBarBattleSessionMap.get(player) : BossBar.bossBar(comp, 0, Color.WHITE, Overlay.PROGRESS);
bossBar.progress((float) (remaining / 100.0));
bossBar.name(comp);
if (!bossBarBattleSessionMap.containsKey(player)) {
bossBarBattleSessionMap.put(player, bossBar);
Towny.getAdventure().player(player).showBossBar(bossBar);
}
}
}
use of com.palmergames.adventure.bossbar.BossBar in project SiegeWar by TownyAdvanced.
the class BossBarUtil method updateBannerCapBossBar.
public static void updateBannerCapBossBar(Player player, String msg, BannerControlSession bannerControlSession) {
Resident resident = TownyAPI.getInstance().getResident(player);
if (resident == null || ResidentMetaDataController.getBossBarsDisabled(resident))
return;
TextComponent comp = Component.text(msg);
float remaining = getRemainder(bannerControlSession.getSessionEndTime(), SiegeWarSettings.getWarSiegeBannerControlSessionDurationMinutes());
BossBar bossBar = bossBarBannerCapMap.containsKey(player) ? bossBarBannerCapMap.get(player) : BossBar.bossBar(comp, 0, Color.WHITE, Overlay.PROGRESS);
bossBar.progress(remaining);
bossBar.name(comp);
if (!bossBarBannerCapMap.containsKey(player)) {
bossBarBannerCapMap.put(player, bossBar);
Towny.getAdventure().player(player).showBossBar(bossBar);
}
}
Aggregations