- Add new chat slug: {primaryresidentrank}

- When a resident has a primary rank with a prefix this will display
their prefix with a space added to the end.
    - Primary ranks and their prefixes are set in the townyperms.yml
like so:
      - towny.rankpriority.#
      - towny.rankprefix.<somewordshere>
This commit is contained in:
LlmDl committed 2023-05-30 10:35:45 -05:00
1 parent 11b86c7f1c
commit 666458f7f3
3 files changed
+17 -2

No files matched your search

+6 -1
View File
@@ -454,4 +454,9 @@ v0.105:
v0.106:
- Add focusable option to channels in the channels.yml.
- By default channels are focusable and adding focusable: true has no effect.
- Adding focusable: false will prevent players making their primary channel, ie using /tc with no message.
- Adding focusable: false will prevent players making their primary channel, ie using /tc with no message.
- Add new chat slug: {primaryresidentrank}
- When a resident has a primary rank with a prefix this will display their prefix with a space added to the end.
- Primary ranks and their prefixes are set in the townyperms.yml like so:
- towny.rankpriority.#
- towny.rankprefix.<somewordshere>
@@ -46,6 +46,7 @@ public class TownyChatFormatter {
replacer.registerReplacer("{permgroupprefix}", event -> getVaultPrefixSuffix(event.getResident(), "groupprefix"));
replacer.registerReplacer("{permgroupsuffix}", event -> getVaultPrefixSuffix(event.getResident(), "groupsuffix"));
replacer.registerReplacer("{playername}", event -> event.getEvent().getPlayer().getName());
replacer.registerReplacer("{primaryresidentrank}", event -> getPrimaryRankPrefix(event.getResident()));
}
public static String getChatFormat(LocalTownyChatEvent event) {
@@ -176,7 +177,14 @@ public class TownyChatFormatter {
return TownySettings.getMayorPostfix(resident);
return "";
}
public static String getPrimaryRankPrefix(Resident resident) {
if (resident == null)
return "";
String rank = resident.getPrimaryRankPrefix();
return rank.isEmpty() ? "" : rank + " ";
}
private static String getName(Government gov) {
return StringMgmt.remUnderscore(gov.getName());
}
@@ -53,6 +53,8 @@ public enum ChatConfigNodes {
"# {permprefix} - Permission group and user prefix.",
"# {permsuffix} - Permission group and user suffix.",
"#",
"# {primaryresidentrank} - When a resident has a primary rank with a prefix this will display their prefix with a space added to the end.",
"#",
"# {playername} - Default player name.",
"# {modplayername} - Modified player name (use if Towny is over writing some other plugins changes).",
"# {msg} - The message sent.",