Added shield status placeholder

This commit is contained in:
Driftay 2020-06-08 15:03:36 -04:00
parent b7d991c0dd
commit 7b94367eb4
4 changed files with 22 additions and 0 deletions

View File

@ -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, String>) 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)) {

View File

@ -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
*/

View File

@ -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:

View File

@ -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)