Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sanctioned towns hover component to nation status screen #7207

Merged
merged 3 commits into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,18 @@ public static StatusScreen getStatus(Nation nation, CommandSender sender) {
.append(Component.newline())
.append(translator.component("status_hover_click_for_more"))),
ClickEvent.runCommand("/towny:nation enemylist " + nation.getName()));

// [Sanctioned Towns] with hover showing Sanctioned Towns [3]: Prague, Berlin, Vienna
List<String> sanctionedTowns = getFormattedNames(nation.getSanctionedTowns());
if (sanctionedTowns.size() > 10)
shortenOverLengthList(sanctionedTowns, 11, translator);

if (sanctionedTowns.size() > 0)
screen.addComponentOf("sanctionedtowns", colourHoverKey(translator.of("status_nation_sanctioned_towns")),
HoverEvent.showText(TownyComponents.miniMessage(getFormattedStrings(translator.of("status_nation_sanctioned_towns"), sanctionedTowns, nation.getSanctionedTowns().size()))
.append(Component.newline())
.append(translator.component("status_hover_click_for_more"))),
ClickEvent.runCommand("/towny:nation sanctiontown list " + nation.getName()));

// Add any metadata which opt to be visible.
List<Component> fields = getExtraFields(nation);
Expand Down
4 changes: 3 additions & 1 deletion Towny/src/main/resources/lang/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2426,4 +2426,6 @@ msg_err_unable_to_use_bank_outside_bank_plot_no_homeblock: 'You cannot use that

msg_err_you_cannot_outlaw_your_mayor: "You cannot outlaw your town's mayor."

msg_err_you_cannot_outlaw_because_of_rank: "You cannot outlaw %s because of a town rank they hold."
msg_err_you_cannot_outlaw_because_of_rank: "You cannot outlaw %s because of a town rank they hold."

status_nation_sanctioned_towns: "Sanctioned Towns"
Loading