From 26bb8ef36842a0ac4fecba0dd0be5ccad4da7aa7 Mon Sep 17 00:00:00 2001 From: Fruitloopins <49851457+Fruitloopins@users.noreply.github.com> Date: Thu, 25 Jan 2024 14:52:12 +1100 Subject: [PATCH 1/3] Add sanctioned towns hover component to nation status screen --- .../com/palmergames/bukkit/towny/TownyFormatter.java | 12 ++++++++++++ Towny/src/main/resources/lang/en-US.yml | 4 +++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Towny/src/main/java/com/palmergames/bukkit/towny/TownyFormatter.java b/Towny/src/main/java/com/palmergames/bukkit/towny/TownyFormatter.java index c394fa42ee..228a2789a8 100644 --- a/Towny/src/main/java/com/palmergames/bukkit/towny/TownyFormatter.java +++ b/Towny/src/main/java/com/palmergames/bukkit/towny/TownyFormatter.java @@ -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 [3]: Prague, Berlin, Vienna + List 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")); // Add any metadata which opt to be visible. List fields = getExtraFields(nation); diff --git a/Towny/src/main/resources/lang/en-US.yml b/Towny/src/main/resources/lang/en-US.yml index eb76677656..15d5aa4f28 100644 --- a/Towny/src/main/resources/lang/en-US.yml +++ b/Towny/src/main/resources/lang/en-US.yml @@ -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." \ No newline at end of file +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" \ No newline at end of file From 8ac82f4a877f98d11d71d6a633dca1551194cda2 Mon Sep 17 00:00:00 2001 From: Fruitloopins <49851457+Fruitloopins@users.noreply.github.com> Date: Thu, 25 Jan 2024 21:14:16 +1100 Subject: [PATCH 2/3] Use nation name in click event --- .../main/java/com/palmergames/bukkit/towny/TownyFormatter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Towny/src/main/java/com/palmergames/bukkit/towny/TownyFormatter.java b/Towny/src/main/java/com/palmergames/bukkit/towny/TownyFormatter.java index 228a2789a8..7078038778 100644 --- a/Towny/src/main/java/com/palmergames/bukkit/towny/TownyFormatter.java +++ b/Towny/src/main/java/com/palmergames/bukkit/towny/TownyFormatter.java @@ -518,7 +518,7 @@ public static StatusScreen getStatus(Nation nation, CommandSender sender) { 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")); + ClickEvent.runCommand("/towny:nation sanctiontown list " + nation.getName())); // Add any metadata which opt to be visible. List fields = getExtraFields(nation); From 6d86c25e47a7641414e1226620b509eef13cc48e Mon Sep 17 00:00:00 2001 From: 3 <49851457+Fruitloopins@users.noreply.github.com> Date: Fri, 26 Jan 2024 07:45:01 +1100 Subject: [PATCH 3/3] Update comment --- .../main/java/com/palmergames/bukkit/towny/TownyFormatter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Towny/src/main/java/com/palmergames/bukkit/towny/TownyFormatter.java b/Towny/src/main/java/com/palmergames/bukkit/towny/TownyFormatter.java index 7078038778..10bb4f447c 100644 --- a/Towny/src/main/java/com/palmergames/bukkit/towny/TownyFormatter.java +++ b/Towny/src/main/java/com/palmergames/bukkit/towny/TownyFormatter.java @@ -508,7 +508,7 @@ public static StatusScreen getStatus(Nation nation, CommandSender sender) { .append(translator.component("status_hover_click_for_more"))), ClickEvent.runCommand("/towny:nation enemylist " + nation.getName())); - // Sanctioned Towns [3]: Prague, Berlin, Vienna + // [Sanctioned Towns] with hover showing Sanctioned Towns [3]: Prague, Berlin, Vienna List sanctionedTowns = getFormattedNames(nation.getSanctionedTowns()); if (sanctionedTowns.size() > 10) shortenOverLengthList(sanctionedTowns, 11, translator);