Add placeholders to f show

This commit is contained in:
Trent Hensler 2018-02-17 12:17:37 -06:00
parent 3f1edf1096
commit d45b5ac612
4 changed files with 20 additions and 4 deletions

View File

@ -7,6 +7,7 @@ import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TL;
import com.massivecraft.factions.zcore.util.TagReplacer; import com.massivecraft.factions.zcore.util.TagReplacer;
import com.massivecraft.factions.zcore.util.TagUtil; import com.massivecraft.factions.zcore.util.TagUtil;
import me.clip.placeholderapi.PlaceholderAPI;
import mkremins.fanciful.FancyMessage; import mkremins.fanciful.FancyMessage;
import java.util.ArrayList; import java.util.ArrayList;
@ -87,6 +88,9 @@ public class CmdShow extends FCommand {
if (parsed == null) { if (parsed == null) {
continue; // Due to minimal f show. continue; // Due to minimal f show.
} }
parsed = TagUtil.parsePlaceholders(fme.getPlayer(), parsed);
if (TagUtil.hasFancy(parsed)) { if (TagUtil.hasFancy(parsed)) {
List<FancyMessage> fancy = TagUtil.parseFancy(faction, fme, parsed); List<FancyMessage> fancy = TagUtil.parseFancy(faction, fme, parsed);
if (fancy != null) { if (fancy != null) {

View File

@ -70,7 +70,6 @@ public abstract class MemoryFPlayer implements FPlayer {
protected transient boolean loginPvpDisabled; protected transient boolean loginPvpDisabled;
protected transient long lastFrostwalkerMessage; protected transient long lastFrostwalkerMessage;
public void login() { public void login() {
this.kills = getPlayer().getStatistic(Statistic.PLAYER_KILLS); this.kills = getPlayer().getStatistic(Statistic.PLAYER_KILLS);
this.deaths = getPlayer().getStatistic(Statistic.DEATHS); this.deaths = getPlayer().getStatistic(Statistic.DEATHS);
@ -305,7 +304,6 @@ public abstract class MemoryFPlayer implements FPlayer {
return lastLoginTime; return lastLoginTime;
} }
public void setLastLoginTime(long lastLoginTime) { public void setLastLoginTime(long lastLoginTime) {
losePowerFromBeingOffline(); losePowerFromBeingOffline();
this.lastLoginTime = lastLoginTime; this.lastLoginTime = lastLoginTime;
@ -928,7 +926,7 @@ public abstract class MemoryFPlayer implements FPlayer {
} }
public void setMapHeight(int height) { 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) { public String getNameAndTitle(FPlayer fplayer) {

View File

@ -6,8 +6,10 @@ import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.P; import com.massivecraft.factions.P;
import com.massivecraft.factions.util.MiscUtil; import com.massivecraft.factions.util.MiscUtil;
import me.clip.placeholderapi.PlaceholderAPI;
import mkremins.fanciful.FancyMessage; import mkremins.fanciful.FancyMessage;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -94,6 +96,18 @@ public class TagUtil {
return null; 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 * Checks if a line has fancy variables
* *

View File

@ -89,7 +89,7 @@ tooltips:
- "&6Last Seen: &f{lastSeen}" - "&6Last Seen: &f{lastSeen}"
- "&6Power: &f{power}" - "&6Power: &f{power}"
- "&6Rank: &f{group}" - "&6Rank: &f{group}"
- "&6Balance: &a${player-balance}" - "&6Balance: &a${balance}"
# Configuration section for Scoreboards # Configuration section for Scoreboards
# This will allow you to completely customize how your scoreboards look. # This will allow you to completely customize how your scoreboards look.