Skip to content

Commit

Permalink
Add upkeep to town info item
Browse files Browse the repository at this point in the history
  • Loading branch information
Warriorrrr committed Apr 8, 2024
1 parent e2e2120 commit 868f290
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,14 @@ public static MenuItem.Builder formatTownInfo(Player player,Town town) {
lore.add(of("town-menu-town-info-founded").append(Time.ago(town.getRegistered()).translate()).component(locale).color(GREEN));
lore.add(text(town.getNumResidents(), DARK_GREEN).append(of("town-menu-town-info-resident").append(town.getNumResidents() == 1 ? "" : "s").component(locale).color(GREEN)));

if (TownySettings.isEconomyAsync() && TownyEconomyHandler.isActive())
lore.add(of("town-menu-town-info-balance").component(locale).append(text(TownyEconomyHandler.getFormattedBalance(town.getAccount().getCachedBalance()), GREEN)));
if (TownyEconomyHandler.isActive()) {
// Only add bank balance when it's safe to do so
if (TownySettings.isEconomyAsync())
lore.add(of("town-menu-town-info-balance").component(locale).append(text(TownyEconomyHandler.getFormattedBalance(town.getAccount().getCachedBalance()), GREEN)));

if (town.hasUpkeep())
lore.add(of("status_bank_town2").component(locale).color(DARK_GREEN).appendSpace().append(text(TownyEconomyHandler.getFormattedBalance(TownySettings.getTownUpkeepCost(town)), GREEN)));
}

if (town.getMayor() != null)
lore.add(of("town-menu-town-info-owned-by").component(locale).append(text(town.getMayor().getName(), GREEN)));
Expand Down

0 comments on commit 868f290

Please sign in to comment.