From af9fc526d73c58893f0d5f8b113a2623d92377b9 Mon Sep 17 00:00:00 2001 From: Trent Hensler Date: Sat, 6 Jan 2018 14:04:42 -0800 Subject: [PATCH] Allow the use of placeholders in scoreboards --- src/main/java/com/massivecraft/factions/P.java | 4 ++++ .../massivecraft/factions/scoreboards/FSidebarProvider.java | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/main/java/com/massivecraft/factions/P.java b/src/main/java/com/massivecraft/factions/P.java index f23868e3..f3d2e55f 100644 --- a/src/main/java/com/massivecraft/factions/P.java +++ b/src/main/java/com/massivecraft/factions/P.java @@ -134,6 +134,10 @@ public class P extends MPlugin { } } + public boolean isPlaceholderAPIHooked() { + return this.placeholderAPIManager != null; + } + private boolean setupPermissions() { try { RegisteredServiceProvider rsp = getServer().getServicesManager().getRegistration(Permission.class); diff --git a/src/main/java/com/massivecraft/factions/scoreboards/FSidebarProvider.java b/src/main/java/com/massivecraft/factions/scoreboards/FSidebarProvider.java index 1a2ed9b7..68169058 100644 --- a/src/main/java/com/massivecraft/factions/scoreboards/FSidebarProvider.java +++ b/src/main/java/com/massivecraft/factions/scoreboards/FSidebarProvider.java @@ -5,6 +5,7 @@ import com.massivecraft.factions.Faction; import com.massivecraft.factions.P; import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TagUtil; +import me.clip.placeholderapi.PlaceholderAPI; import java.util.List; @@ -19,6 +20,10 @@ public abstract class FSidebarProvider { } public String replaceTags(Faction faction, FPlayer fPlayer, String s) { + // Run through Placeholder API first + if (P.p.isPlaceholderAPIHooked() && fPlayer.isOnline()) { + s = PlaceholderAPI.setPlaceholders(fPlayer.getPlayer(), s); + } return qualityAssure(TagUtil.parsePlain(faction, fPlayer, s)); }