From d45b5ac612af25e739e7f4b3d94424c652f0112d Mon Sep 17 00:00:00 2001 From: Trent Hensler Date: Sat, 17 Feb 2018 12:17:37 -0600 Subject: [PATCH] Add placeholders to f show --- .../com/massivecraft/factions/cmd/CmdShow.java | 4 ++++ .../factions/zcore/persist/MemoryFPlayer.java | 4 +--- .../massivecraft/factions/zcore/util/TagUtil.java | 14 ++++++++++++++ src/main/resources/config.yml | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdShow.java b/src/main/java/com/massivecraft/factions/cmd/CmdShow.java index 6ffbf326..91be9390 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdShow.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdShow.java @@ -7,6 +7,7 @@ import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TagReplacer; import com.massivecraft.factions.zcore.util.TagUtil; +import me.clip.placeholderapi.PlaceholderAPI; import mkremins.fanciful.FancyMessage; import java.util.ArrayList; @@ -87,6 +88,9 @@ public class CmdShow extends FCommand { if (parsed == null) { continue; // Due to minimal f show. } + + parsed = TagUtil.parsePlaceholders(fme.getPlayer(), parsed); + if (TagUtil.hasFancy(parsed)) { List fancy = TagUtil.parseFancy(faction, fme, parsed); if (fancy != null) { diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java index 41c7c79d..2e594e1d 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java @@ -70,7 +70,6 @@ public abstract class MemoryFPlayer implements FPlayer { protected transient boolean loginPvpDisabled; protected transient long lastFrostwalkerMessage; - public void login() { this.kills = getPlayer().getStatistic(Statistic.PLAYER_KILLS); this.deaths = getPlayer().getStatistic(Statistic.DEATHS); @@ -305,7 +304,6 @@ public abstract class MemoryFPlayer implements FPlayer { return lastLoginTime; } - public void setLastLoginTime(long lastLoginTime) { losePowerFromBeingOffline(); this.lastLoginTime = lastLoginTime; @@ -928,7 +926,7 @@ public abstract class MemoryFPlayer implements FPlayer { } public void setMapHeight(int height) { - this.mapHeight = height > Conf.mapHeight * 2 ? Conf.mapHeight * 2 : height; + this.mapHeight = height > (Conf.mapHeight * 2) ? (Conf.mapHeight * 2) : height; } public String getNameAndTitle(FPlayer fplayer) { diff --git a/src/main/java/com/massivecraft/factions/zcore/util/TagUtil.java b/src/main/java/com/massivecraft/factions/zcore/util/TagUtil.java index a0301d35..4bf18fbf 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TagUtil.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TagUtil.java @@ -6,8 +6,10 @@ import com.massivecraft.factions.Faction; import com.massivecraft.factions.Factions; import com.massivecraft.factions.P; import com.massivecraft.factions.util.MiscUtil; +import me.clip.placeholderapi.PlaceholderAPI; import mkremins.fanciful.FancyMessage; import org.bukkit.ChatColor; +import org.bukkit.entity.Player; import java.util.ArrayList; import java.util.List; @@ -94,6 +96,18 @@ public class TagUtil { return null; } + public static String parsePlaceholders(Player player, String line) { + if (P.p.isClipPlaceholderAPIHooked() && player.isOnline()) { + line = PlaceholderAPI.setPlaceholders(player, line); + } + + if (P.p.isMVdWPlaceholderAPIHooked() && player.isOnline()) { + line = be.maximvdw.placeholderapi.PlaceholderAPI.replacePlaceholders(player, line); + } + + return line; + } + /** * Checks if a line has fancy variables * diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 3a123258..dcb92681 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -89,7 +89,7 @@ tooltips: - "&6Last Seen: &f{lastSeen}" - "&6Power: &f{power}" - "&6Rank: &f{group}" - - "&6Balance: &a${player-balance}" + - "&6Balance: &a${balance}" # Configuration section for Scoreboards # This will allow you to completely customize how your scoreboards look.