diff --git a/src/main/java/com/massivecraft/factions/tag/FactionTag.java b/src/main/java/com/massivecraft/factions/tag/FactionTag.java index c799e47b..67e87aa5 100644 --- a/src/main/java/com/massivecraft/factions/tag/FactionTag.java +++ b/src/main/java/com/massivecraft/factions/tag/FactionTag.java @@ -4,9 +4,13 @@ import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; import com.massivecraft.factions.FactionsPlugin; +import com.massivecraft.factions.cmd.shields.struct.ShieldTCMP; +import com.massivecraft.factions.cmd.shields.struct.tasks.ShieldManagement; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Relation; +import com.massivecraft.factions.util.timer.DateTimeFormats; import com.massivecraft.factions.zcore.util.TL; +import org.apache.commons.lang.time.DurationFormatUtils; import java.util.function.BiFunction; import java.util.function.Function; @@ -36,6 +40,11 @@ public enum FactionTag implements Tag { JOINING("{joining}", (fac) -> (fac.getOpen() ? TL.COMMAND_SHOW_UNINVITED.toString() : TL.COMMAND_SHOW_INVITATION.toString())), FACTION("{faction}", (Function) Faction::getTag), FACTION_RELATION_COLOR("{faction-relation-color}", (fac, fp) -> fp == null ? "" : fp.getColorTo(fac).toString()), + SHIELD_STATUS("{shield-status}",(fac) -> { + if(fac.isProtected() && fac.getShieldFrame() != null) return String.valueOf(TL.SHIELD_CURRENTLY_ENABLE); + if(fac.getShieldFrame() == null) return String.valueOf(TL.SHIELD_NOT_SET); + return TL.SHIELD_CURRENTLY_NOT_ENABLED.toString(); + }), HOME_WORLD("{world}", (fac) -> fac.hasHome() ? fac.getHome().getWorld().getName() : Tag.isMinimalShow() ? null : "{ig}"), RAIDABLE("{raidable}", (fac) -> { if (FactionsPlugin.getInstance().getConfig().getBoolean("hcf.raidable", false)) { diff --git a/src/main/java/com/massivecraft/factions/zcore/util/TL.java b/src/main/java/com/massivecraft/factions/zcore/util/TL.java index 9b26a185..6d239f72 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TL.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TL.java @@ -1254,6 +1254,10 @@ public enum TL { PLAYER_PVP_NEUTRALFAIL("You can't hurt %s in their own territory unless you declare them as an enemy."), PLAYER_PVP_TRIED("%s tried to hurt you."), + SHIELD_CURRENTLY_ENABLE("&a&lCurrently Protected"), + SHIELD_NOT_SET("&c&lNot Set"), + SHIELD_CURRENTLY_NOT_ENABLED("&c&lCurrently Unprotected"), + /** * Strings lying around in other bits of the plugins */ diff --git a/src/main/java/com/massivecraft/factions/zcore/util/TagReplacer.java b/src/main/java/com/massivecraft/factions/zcore/util/TagReplacer.java index 37311e0c..6c89e022 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TagReplacer.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TagReplacer.java @@ -1,9 +1,11 @@ package com.massivecraft.factions.zcore.util; import com.massivecraft.factions.*; +import com.massivecraft.factions.cmd.shields.struct.tasks.ShieldManagement; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.util.timer.TimerManager; +import org.apache.commons.lang.time.DateFormatUtils; import org.apache.commons.lang.time.DurationFormatUtils; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -78,6 +80,7 @@ public enum TagReplacer { FACTION_BANCOUNT(TagType.FACTION, "{faction-bancount}"), FACTION_STRIKES(TagType.FACTION, "{strikes}"), FACTION_POINTS(TagType.FACTION, "{faction-points}"), + SHIELD_STATUS(TagType.FACTION, "{shield-status}"), /** @@ -239,6 +242,10 @@ public enum TagReplacer { return fac.hasHome() ? String.valueOf(fac.getHome().getBlockY()) : minimal ? null : "{ig}"; case HOME_Z: return fac.hasHome() ? String.valueOf(fac.getHome().getBlockZ()) : minimal ? null : "{ig}"; + case SHIELD_STATUS: + if(fac.isProtected() && fac.getShieldFrame() != null) return String.valueOf(TL.SHIELD_CURRENTLY_ENABLE); + if(fac.getShieldFrame() == null) return String.valueOf(TL.SHIELD_NOT_SET); + return TL.SHIELD_CURRENTLY_NOT_ENABLED.toString(); case LAND_VALUE: return Econ.shouldBeUsed() ? Econ.moneyString(Econ.calculateTotalLandValue(fac.getLandRounded())) : minimal ? null : TL.ECON_OFF.format("value"); case LAND_REFUND: diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 90aa6ab7..2801b537 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -282,6 +282,7 @@ show: - '&4* &cDescription: &f{description}' - '&4* &cLand / Power / Max Power: &f{chunks} &8/ &f{power} &8/ &f{maxPower}' - '&4* &cFaction Strikes: &f{strikes}' + - '&4* &cShield Status: &f{shield-status}' - '&4* &cFaction Points: &f{faction-points}' - '&4* &cFounded: &f{create-date}' - '&4* &cBalance: &f{faction-balance}' @@ -1666,6 +1667,7 @@ Wild: # - {tnt-balance} : # of tnt a faction has in their tnt bank # - {tnt-max-balance} : # of possible tnt a faction can have in their tnt bank # - {faction-strikes} : # of strikes a faction has +# - {shield-status} : Status of the factions shield # Faction Permissions GUI variables. Can only be used in GUI # - {relation} : Shows relation name (Can be used in action and relation)