Skip to content

Commit

Permalink
- %townyadvanced_towny_tag_override_with_minimessage_colour%
Browse files Browse the repository at this point in the history
    - This will use the town or nation's tag if they have a tag in use.
  • Loading branch information
LlmDl committed Dec 3, 2024
1 parent 1614f03 commit 1e5b4a8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,31 @@ else if (!town.isEmpty())
else if (!town.isEmpty())
tag = String.format(TownySettings.getPAPIFormattingTown(), town);
return tag;
case "towny_tag_override_with_minimessage_colour": // %townyadvanced_towny_tag_override_with_minimessage_colour%
if (resident.hasTown()) {
if (resident.getTownOrNull().hasTag())
town = resident.getTownOrNull().getTag();
else
town = StringMgmt.remUnderscore(resident.getTownOrNull().getName());
String townHexColour = resident.getTownOrNull().getMapColorHexCode();
if (townHexColour != null)
town = "<#"+townHexColour+">" + town;

if (resident.hasNation()) {
if (resident.getNationOrNull().hasTag())
nation = resident.getNationOrNull().getTag();
else
StringMgmt.remUnderscore(nation = resident.getNationOrNull().getName());
String nationHexColour = resident.getNationOrNull().getMapColorHexCode();
if (nationHexColour != null)
nation = "<#"+nationHexColour+">" + nation;
}
}
if (!nation.isEmpty())
tag = TownySettings.getPAPIFormattingBoth().replace("%t", town).replace("%n", nation);
else if (!town.isEmpty())
tag = String.format(TownySettings.getPAPIFormattingTown(), town);
return tag;
case "title": // %townyadvanced_title%
if (resident.hasTitle())
title = resident.getTitle();
Expand Down
4 changes: 3 additions & 1 deletion Towny/src/main/resources/ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10164,4 +10164,6 @@ v0.92.0.11:
- New Placeholders:
- %townyadvanced_town_formatted_with_town_minimessage_colour%
- %townyadvanced_nation_formatted_with_nation_minimessage_colour%
- These will use the Towny config's town and nation placeholder formatting, but insert the town or nation's colour code before the town or nation name.
- These will use the Towny config's town and nation placeholder formatting, but insert the town or nation's colour code before the town or nation name.
- %townyadvanced_towny_tag_override_with_minimessage_colour%
- This will use the town or nation's tag if they have a tag in use.

0 comments on commit 1e5b4a8

Please sign in to comment.