diff --git a/Towny/src/main/java/com/palmergames/bukkit/towny/hooks/TownyPlaceholderExpansion.java b/Towny/src/main/java/com/palmergames/bukkit/towny/hooks/TownyPlaceholderExpansion.java index 3c80c9147c..d2e7ed96ea 100644 --- a/Towny/src/main/java/com/palmergames/bukkit/towny/hooks/TownyPlaceholderExpansion.java +++ b/Towny/src/main/java/com/palmergames/bukkit/towny/hooks/TownyPlaceholderExpansion.java @@ -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(); diff --git a/Towny/src/main/resources/ChangeLog.txt b/Towny/src/main/resources/ChangeLog.txt index f60df1f258..179083c270 100644 --- a/Towny/src/main/resources/ChangeLog.txt +++ b/Towny/src/main/resources/ChangeLog.txt @@ -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. \ No newline at end of file + - 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. \ No newline at end of file