Adding some placeholders

This commit is contained in:
Driftay 2020-01-17 21:36:36 -05:00
parent 90d39a3974
commit 9a32cd9501
4 changed files with 23 additions and 4 deletions

View File

@ -73,6 +73,9 @@ public class EngineDynmap {
}
public static String escapeHtml(String string) {
if (string == null) {
return "";
}
StringBuilder out = new StringBuilder(Math.max(16, string.length()));
for (int i = 0; i < string.length(); i++) {
char c = string.charAt(i);

View File

@ -49,6 +49,7 @@ public enum FactionTag implements Tag {
}
return null;
}),
PEACEFUL("{peaceful}", (fac) -> fac.isPeaceful() ? Conf.colorNeutral + TL.COMMAND_SHOW_PEACEFUL.toString() : ""),
PERMANENT("permanent", (fac) -> fac.isPermanent() ? "permanent" : "{notPermanent}"), // no braces needed
LAND_VALUE("{land-value}", (fac) -> Econ.shouldBeUsed() ? Econ.moneyString(Econ.calculateTotalLandValue(fac.getLandRounded())) : Tag.isMinimalShow() ? null : TL.ECON_OFF.format("value")),
@ -61,6 +62,19 @@ public enum FactionTag implements Tag {
}
return Tag.isMinimalShow() ? null : TL.ECON_OFF.format("balance");
}),
TNT_BALANCE("{tnt-balance}", (fac) -> {
if (FactionsPlugin.instance.getConfig().getBoolean("ftnt.Enabled")) {
return String.valueOf(fac.getTnt());
}
return Tag.isMinimalShow() ? null : "";
}),
TNT_MAX("{tnt-max-balance}", (fac) -> {
if (FactionsPlugin.instance.getConfig().getBoolean("ftnt.Enabled")) {
return String.valueOf(fac.getTntBankLimit());
}
return Tag.isMinimalShow() ? null : "";
}),
ALLIES_COUNT("{allies}", (fac) -> String.valueOf(fac.getRelationCount(Relation.ALLY))),
ENEMIES_COUNT("{enemies}", (fac) -> String.valueOf(fac.getRelationCount(Relation.ENEMY))),
TRUCES_COUNT("{truces}", (fac) -> String.valueOf(fac.getRelationCount(Relation.TRUCE))),
@ -80,6 +94,8 @@ public enum FactionTag implements Tag {
return String.valueOf(fac.getFPlayersWhereOnline(false).size());
}
}),
FACTION_STRIKES("{faction-strikes}",(fac) -> String.valueOf(fac.getStrikes())),
FACTION_POINTS("{faction-points}", (fac) -> String.valueOf(fac.getPoints())),
FACTION_SIZE("{members}", (fac) -> String.valueOf(fac.getFPlayers().size())),
FACTION_KILLS("{faction-kills}", (fac) -> String.valueOf(fac.getKills())),
FACTION_DEATHS("{faction-deaths}", (fac) -> String.valueOf(fac.getDeaths())),

View File

@ -100,7 +100,7 @@ public enum FancyTag implements Tag {
return tag.getMessage(text, faction, player, groupMap);
}
}
return Collections.EMPTY_LIST; // We really shouldn't be here.
return Collections.emptyList(); // We really shouldn't be here.
}
public static boolean anyMatch(String text) {
@ -174,7 +174,7 @@ public enum FancyTag implements Tag {
return test != null && test.contains(this.tag);
}
public List<FancyMessage> getMessage(String text, Faction faction, FPlayer player, Map<UUID, String> groupMap) {
public List getMessage(String text, Faction faction, FPlayer player, Map<UUID, String> groupMap) {
if (!this.foundInString(text)) {
return Collections.EMPTY_LIST; // We really, really shouldn't be here.
}

View File

@ -18,8 +18,8 @@ public enum GeneralTag implements Tag {
MAX_ALLIES("{max-allies}", () -> getRelation("ally")),
MAX_ENEMIES("{max-enemies}", () -> getRelation("enemy")),
MAX_TRUCES("{max-truces}", () -> getRelation("truce")),
FACTIONLESS("factionless", () -> String.valueOf(FPlayers.getInstance().getOnlinePlayers().stream().filter(p -> !p.hasFaction()).count())),
FACTIONLESS_TOTAL("factionless-total", () -> String.valueOf(FPlayers.getInstance().getAllFPlayers().stream().filter(p -> !p.hasFaction()).count())),
FACTIONLESS("{factionless}", () -> String.valueOf(FPlayers.getInstance().getOnlinePlayers().stream().filter(p -> !p.hasFaction()).count())),
FACTIONLESS_TOTAL("{factionless-total}", () -> String.valueOf(FPlayers.getInstance().getAllFPlayers().stream().filter(p -> !p.hasFaction()).count())),
TOTAL_ONLINE("{total-online}", () -> String.valueOf(Bukkit.getOnlinePlayers().size())),
;