diff --git a/pom.xml b/pom.xml
index 551c9d13..5ffffd34 100644
--- a/pom.xml
+++ b/pom.xml
@@ -59,6 +59,11 @@
com.griefcraft
lwc
+
+
+ me.clip
+ placeholderapi
+
diff --git a/src/com/massivecraft/factions/Factions.java b/src/com/massivecraft/factions/Factions.java
index 22f156c2..e1826d3e 100644
--- a/src/com/massivecraft/factions/Factions.java
+++ b/src/com/massivecraft/factions/Factions.java
@@ -62,6 +62,7 @@ import com.massivecraft.factions.event.EventFactionsChunkChangeType;
import com.massivecraft.factions.integration.V18.IntegrationV18;
import com.massivecraft.factions.integration.V19.IntegrationV19;
import com.massivecraft.factions.integration.lwc.IntegrationLwc;
+import com.massivecraft.factions.integration.placeholderapi.IntegrationPlaceholderAPI;
import com.massivecraft.factions.integration.worldguard.IntegrationWorldGuard;
import com.massivecraft.factions.mixin.PowerMixin;
import com.massivecraft.factions.task.TaskEconLandReward;
@@ -178,6 +179,7 @@ public class Factions extends MassivePlugin
public List> getClassesActiveIntegrations()
{
return MUtil.list(
+ IntegrationPlaceholderAPI.class,
IntegrationV18.class,
IntegrationV19.class,
IntegrationLwc.class,
diff --git a/src/com/massivecraft/factions/integration/placeholderapi/IntegrationPlaceholderAPI.java b/src/com/massivecraft/factions/integration/placeholderapi/IntegrationPlaceholderAPI.java
new file mode 100644
index 00000000..689d8125
--- /dev/null
+++ b/src/com/massivecraft/factions/integration/placeholderapi/IntegrationPlaceholderAPI.java
@@ -0,0 +1,28 @@
+package com.massivecraft.factions.integration.placeholderapi;
+
+import com.massivecraft.massivecore.Integration;
+
+public class IntegrationPlaceholderAPI extends Integration
+{
+ // -------------------------------------------- //
+ // INSTANCE & CONSTRUCT
+ // -------------------------------------------- //
+
+ private static IntegrationPlaceholderAPI i = new IntegrationPlaceholderAPI();
+ public static IntegrationPlaceholderAPI get() { return i; }
+ private IntegrationPlaceholderAPI()
+ {
+ this.setPluginName("PlaceholderAPI");
+ }
+
+ // -------------------------------------------- //
+ // OVERRIDE
+ // -------------------------------------------- //
+
+ @Override
+ public void setIntegrationActiveInner(boolean active)
+ {
+ PlaceholderFactions.get().register();
+ }
+
+}
diff --git a/src/com/massivecraft/factions/integration/placeholderapi/PlaceholderFactions.java b/src/com/massivecraft/factions/integration/placeholderapi/PlaceholderFactions.java
new file mode 100644
index 00000000..3a5eb052
--- /dev/null
+++ b/src/com/massivecraft/factions/integration/placeholderapi/PlaceholderFactions.java
@@ -0,0 +1,62 @@
+package com.massivecraft.factions.integration.placeholderapi;
+
+import com.massivecraft.factions.Factions;
+import com.massivecraft.factions.entity.BoardColl;
+import com.massivecraft.factions.entity.MPlayer;
+import me.clip.placeholderapi.expansion.PlaceholderExpansion;
+import org.bukkit.entity.Player;
+
+public class PlaceholderFactions extends PlaceholderExpansion
+{
+ // -------------------------------------------- //
+ // INSTANCE & CONSTRUCT
+ // -------------------------------------------- //
+
+ private static PlaceholderFactions i = new PlaceholderFactions();
+ public static PlaceholderFactions get() { return i; }
+
+ // -------------------------------------------- //
+ // OVERRIDE
+ // -------------------------------------------- //
+
+ public String getIdentifier()
+ {
+ return "factions";
+ }
+
+ public String getAuthor()
+ {
+ return "Madus";
+ }
+
+ public String getVersion()
+ {
+ return Factions.get().getDescription().getVersion();
+ }
+
+ @Override
+ public String onPlaceholderRequest(Player player, String params)
+ {
+ System.out.println("A");
+ if (player == null) return null;
+ System.out.println("B");
+
+
+ MPlayer mplayer = MPlayer.get(player);
+ if ("role".equals(params)) params = "rank";
+ switch (params)
+ {
+ case "faction": return mplayer.getFaction().describeTo(mplayer);
+ case "power": return Double.toString(mplayer.getPower());
+ case "powermax": return Double.toString(mplayer.getPowerMax());
+ case "factionpower": return Double.toString(mplayer.getFaction().getPower());
+ case "factionpowermax": return Double.toString(mplayer.getFaction().getPowerMax());
+ case "title": return mplayer.getTitle();
+ case "rank": return mplayer.getRank().getName();
+ case "claims": return Long.toString(BoardColl.get().getAll().stream().mapToInt(board -> board.getCount(mplayer.getFaction())).sum());
+ case "onlinemembers": return Integer.toString(mplayer.getFaction().getMPlayersWhereOnlineTo(mplayer).size());
+ case "allmembers": return Integer.toString(mplayer.getFaction().getMPlayers().size());
+ }
+ return null;
+ }
+}