Allow the use of placeholders in scoreboards

This commit is contained in:
Trent Hensler 2018-01-06 14:04:42 -08:00
parent fb0c77efc0
commit af9fc526d7
2 changed files with 9 additions and 0 deletions

View File

@ -134,6 +134,10 @@ public class P extends MPlugin {
} }
} }
public boolean isPlaceholderAPIHooked() {
return this.placeholderAPIManager != null;
}
private boolean setupPermissions() { private boolean setupPermissions() {
try { try {
RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class); RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);

View File

@ -5,6 +5,7 @@ import com.massivecraft.factions.Faction;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TL;
import com.massivecraft.factions.zcore.util.TagUtil; import com.massivecraft.factions.zcore.util.TagUtil;
import me.clip.placeholderapi.PlaceholderAPI;
import java.util.List; import java.util.List;
@ -19,6 +20,10 @@ public abstract class FSidebarProvider {
} }
public String replaceTags(Faction faction, FPlayer fPlayer, String s) { 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)); return qualityAssure(TagUtil.parsePlain(faction, fPlayer, s));
} }