Initial placeholderAPI support.

Give me ideas on what else to add and I'll add it.
This commit is contained in:
Trent Hensler
2017-12-30 18:44:42 -08:00
parent 24c7107163
commit fe7002f674
4 changed files with 53 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
package com.massivecraft.factions.util;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.P;
import me.clip.placeholderapi.external.EZPlaceholderHook;
import org.bukkit.entity.Player;
public class PlaceholderAPIManager extends EZPlaceholderHook {
public PlaceholderAPIManager() {
super(P.p, "factionsuuid");
}
@Override
public String onPlaceholderRequest(Player player, String placeholder) {
if(player == null || placeholder == null) {
return "";
}
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
switch(placeholder) {
case "faction":
return fPlayer.getFaction().getTag();
case "power":
return String.valueOf(fPlayer.getPower());
}
return null;
}
}