Skip to content

Commit

Permalink
- New Placeholders:
Browse files Browse the repository at this point in the history
    - %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.
  • Loading branch information
LlmDl committed Dec 3, 2024
1 parent b93aaba commit 1614f03
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Towny/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<artifactId>towny</artifactId>
<packaging>jar</packaging>
<version>0.101.0.2</version>
<version>0.101.0.3</version>

<licenses>
<license>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.palmergames.bukkit.towny.TownyEconomyHandler;
import com.palmergames.bukkit.towny.TownySettings;
import com.palmergames.bukkit.towny.TownyUniverse;
import com.palmergames.bukkit.towny.object.Nation;
import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.util.StringMgmt;
Expand Down Expand Up @@ -205,6 +206,14 @@ private String getOfflinePlayerPlaceholder(OfflinePlayer player, String identifi
if (resident.hasTown())
town = String.format(TownySettings.getPAPIFormattingTown(), resident.getTownOrNull().getFormattedName());
return StringMgmt.remUnderscore(town);
case "town_formatted_with_town_minimessage_colour": // %townyadvanced_town_formatted_with_town_minimessage_colour%
if (resident.hasTown()) {
Town residentTown = resident.getTownOrNull();
String townHexValue = residentTown.getMapColorHexCode();
if (townHexValue != null)
town = String.format(TownySettings.getPAPIFormattingTown(), "<#"+townHexValue+">" + residentTown.getFormattedName());
}
return StringMgmt.remUnderscore(town);
case "nation": // %townyadvanced_nation%
if (resident.hasNation())
nation = String.format(TownySettings.getPAPIFormattingNation(), resident.getNationOrNull().getName());
Expand All @@ -217,6 +226,14 @@ private String getOfflinePlayerPlaceholder(OfflinePlayer player, String identifi
if (resident.hasNation())
nation = String.format(TownySettings.getPAPIFormattingNation(), resident.getNationOrNull().getFormattedName());
return StringMgmt.remUnderscore(nation);
case "nation_formatted_with_nation_minimessage_colour": // %townyadvanced_nation_formatted_with_nation_minimessage_colour%
if (resident.hasNation()) {
Nation residentNation = resident.getNationOrNull();
String nationHexValue = residentNation.getMapColorHexCode();
if (nationHexValue != null)
nation = String.format(TownySettings.getPAPIFormattingNation(), "<#"+nationHexValue+">" + residentNation.getFormattedName());
}
return StringMgmt.remUnderscore(nation);
case "town_balance": // %townyadvanced_town_balance%
if (resident.hasTown() && TownyEconomyHandler.isActive())
balance = getMoney(resident.getTownOrNull().getAccount().getCachedBalance());
Expand Down
7 changes: 6 additions & 1 deletion Towny/src/main/resources/ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10159,4 +10159,9 @@ v0.92.0.11:
- Bump com.zaxxer:HikariCP from 6.0.0 to 6.2.1.
- Drop Java back to 17 to support 1.19.
0.101.0.2:
- Fix legacy economy provider check on admin logging in also running on servers with the economy aspect of Towny disabled.
- Fix legacy economy provider check on admin logging in also running on servers with the economy aspect of Towny disabled.
0.101.0.3:
- 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.

0 comments on commit 1614f03

Please sign in to comment.