From 9a32cd950156674ba45672d52bd0eebd65c94682 Mon Sep 17 00:00:00 2001 From: Driftay Date: Fri, 17 Jan 2020 21:36:36 -0500 Subject: [PATCH] Adding some placeholders --- .../integration/dynmap/EngineDynmap.java | 3 +++ .../massivecraft/factions/tag/FactionTag.java | 16 ++++++++++++++++ .../com/massivecraft/factions/tag/FancyTag.java | 4 ++-- .../massivecraft/factions/tag/GeneralTag.java | 4 ++-- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/integration/dynmap/EngineDynmap.java b/src/main/java/com/massivecraft/factions/integration/dynmap/EngineDynmap.java index f126207c..a44a6daf 100644 --- a/src/main/java/com/massivecraft/factions/integration/dynmap/EngineDynmap.java +++ b/src/main/java/com/massivecraft/factions/integration/dynmap/EngineDynmap.java @@ -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); diff --git a/src/main/java/com/massivecraft/factions/tag/FactionTag.java b/src/main/java/com/massivecraft/factions/tag/FactionTag.java index 5fddeb46..f417cd2c 100644 --- a/src/main/java/com/massivecraft/factions/tag/FactionTag.java +++ b/src/main/java/com/massivecraft/factions/tag/FactionTag.java @@ -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())), diff --git a/src/main/java/com/massivecraft/factions/tag/FancyTag.java b/src/main/java/com/massivecraft/factions/tag/FancyTag.java index 421b355b..5fc060ab 100644 --- a/src/main/java/com/massivecraft/factions/tag/FancyTag.java +++ b/src/main/java/com/massivecraft/factions/tag/FancyTag.java @@ -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 getMessage(String text, Faction faction, FPlayer player, Map groupMap) { + public List getMessage(String text, Faction faction, FPlayer player, Map groupMap) { if (!this.foundInString(text)) { return Collections.EMPTY_LIST; // We really, really shouldn't be here. } diff --git a/src/main/java/com/massivecraft/factions/tag/GeneralTag.java b/src/main/java/com/massivecraft/factions/tag/GeneralTag.java index b419838c..3f364b86 100644 --- a/src/main/java/com/massivecraft/factions/tag/GeneralTag.java +++ b/src/main/java/com/massivecraft/factions/tag/GeneralTag.java @@ -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())), ;