Skip to content

Commit

Permalink
%players.leader.id%
Browse files Browse the repository at this point in the history
Adds the ability to embed the faction leader's ID in the Dynmap popup html (`dynmapDescription`) using `%players.leader.id%`.

Were it not for it breaking everyone's configs I would change `%players.leader%` to be `%players.leader.username%` but 🎼 we can't always get what we want. 🎼
  • Loading branch information
hucario committed Jan 9, 2022
1 parent 710a8fd commit 8ab6c95
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,12 @@ public static String getHtmlPlayerString(Collection<FPlayer> playersOfficersList
}
return ret.toString();
}

public static String getHtmlPlayerName(FPlayer fplayer) {
return fplayer != null ? escapeHtml(fplayer.getName()) : "none";
}
public static String getHtmlPlayerUUID(FPlayer fplayer) {
return fplayer != null ? escapeHtml(fplayer.getAccountId()) : "none";
}

public static String escapeHtml(String string) {
if (string == null) {
Expand Down Expand Up @@ -661,6 +663,7 @@ private String getDescription(Faction faction) {

FPlayer playersLeaderObject = faction.getFPlayerAdmin();
String playersLeader = getHtmlPlayerName(playersLeaderObject);
String playersLeaderId = getHtmlPlayerUUID(playersLeaderObject);

ArrayList<FPlayer> playersCoAdminsList = faction.getFPlayersWhereRole(Role.COLEADER);
String playersCoAdminsCount = String.valueOf(playersCoAdminsList.size());
Expand All @@ -677,6 +680,7 @@ private String getDescription(Faction faction) {
ret = ret.replace("%players%", players);
ret = ret.replace("%players.count%", playersCount);
ret = ret.replace("%players.leader%", playersLeader);
ret = ret.replace("%players.leader.id%", playersLeaderId);
ret = ret.replace("%players.admins%", playersCoAdmins);
ret = ret.replace("%players.admins.count%", playersCoAdminsCount);
ret = ret.replace("%players.moderators%", playersModerators);
Expand Down

0 comments on commit 8ab6c95

Please sign in to comment.