Add suppport for MVdW placeholder API

This commit is contained in:
Trent Hensler 2018-01-06 16:56:43 -08:00
parent af9fc526d7
commit c465d0c9d4
5 changed files with 41 additions and 12 deletions

15
pom.xml
View File

@ -301,6 +301,17 @@
<version>2.8.2</version> <version>2.8.2</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>be.maximvdw</groupId>
<artifactId>MVdWPlaceholderAPI</artifactId>
<version>2.2.3-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies> </dependencies>
<repositories> <repositories>
@ -328,5 +339,9 @@
<id>placeholderapi</id> <id>placeholderapi</id>
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url> <url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository> </repository>
<repository>
<id>mvdw-software</id>
<url>http://repo.mvdw-software.be/content/groups/public/</url>
</repository>
</repositories> </repositories>
</project> </project>

View File

@ -61,7 +61,8 @@ public class P extends MPlugin {
public CmdAutoHelp cmdAutoHelp; public CmdAutoHelp cmdAutoHelp;
private boolean hookedPlayervaults; private boolean hookedPlayervaults;
private PlaceholderAPIManager placeholderAPIManager; private ClipPlaceholderAPIManager clipPlaceholderAPIManager;
private boolean mvdwPlaceholderAPIManager = false;
public P() { public P() {
p = this; p = this;
@ -126,16 +127,26 @@ public class P extends MPlugin {
} }
private void setupPlaceholderAPI() { private void setupPlaceholderAPI() {
Plugin plugin = getServer().getPluginManager().getPlugin("PlaceholderAPI"); Plugin clip = getServer().getPluginManager().getPlugin("PlaceholderAPI");
if (plugin != null && plugin.isEnabled()) { if (clip != null && clip.isEnabled()) {
this.placeholderAPIManager = new PlaceholderAPIManager(); this.clipPlaceholderAPIManager = new ClipPlaceholderAPIManager();
this.placeholderAPIManager.hook(); this.clipPlaceholderAPIManager.hook();
log(Level.INFO, "Found PlaceholderAPI. Adding hooks."); log(Level.INFO, "Found Clip's PlaceholderAPI. Adding hooks.");
}
Plugin mvdw = getServer().getPluginManager().getPlugin("MVdWPlaceholderAPI");
if (mvdw != null && mvdw.isEnabled()) {
this.mvdwPlaceholderAPIManager = true;
log(Level.INFO, "Found MVdWPlaceholderAPI. Adding hooks.");
} }
} }
public boolean isPlaceholderAPIHooked() { public boolean isClipPlaceholderAPIHooked() {
return this.placeholderAPIManager != null; return this.clipPlaceholderAPIManager != null;
}
public boolean isMVdWPlaceholderAPIHooked() {
return this.mvdwPlaceholderAPIManager;
} }
private boolean setupPermissions() { private boolean setupPermissions() {

View File

@ -21,9 +21,12 @@ 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 // Run through Placeholder API first
if (P.p.isPlaceholderAPIHooked() && fPlayer.isOnline()) { if (P.p.isClipPlaceholderAPIHooked() && fPlayer.isOnline()) {
s = PlaceholderAPI.setPlaceholders(fPlayer.getPlayer(), s); s = PlaceholderAPI.setPlaceholders(fPlayer.getPlayer(), s);
} }
if (P.p.isMVdWPlaceholderAPIHooked() && fPlayer.isOnline()) {
s = be.maximvdw.placeholderapi.PlaceholderAPI.replacePlaceholders(fPlayer.getPlayer(), s);
}
return qualityAssure(TagUtil.parsePlain(faction, fPlayer, s)); return qualityAssure(TagUtil.parsePlain(faction, fPlayer, s));
} }

View File

@ -12,9 +12,9 @@ import org.bukkit.entity.Player;
import java.util.UUID; import java.util.UUID;
public class PlaceholderAPIManager extends EZPlaceholderHook { public class ClipPlaceholderAPIManager extends EZPlaceholderHook {
public PlaceholderAPIManager() { public ClipPlaceholderAPIManager() {
super(P.p, "factionsuuid"); super(P.p, "factionsuuid");
} }

View File

@ -2,7 +2,7 @@ name: Factions
version: ${project.version}-b${build.number} version: ${project.version}-b${build.number}
main: com.massivecraft.factions.P main: com.massivecraft.factions.P
authors: [Olof Larsson, Brett Flannigan, drtshock] authors: [Olof Larsson, Brett Flannigan, drtshock]
softdepend: [PlayerVaults, PlaceholderAPI, PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, LWC, nChat, ChatManager, CAPI, AuthMe, Vault, Spout, WorldEdit, WorldGuard, AuthDB, CaptureThePoints, CombatTag, dynmap] softdepend: [PlayerVaults, PlaceholderAPI, MVdWPlaceholderAPI, PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, LWC, nChat, ChatManager, CAPI, AuthMe, Vault, Spout, WorldEdit, WorldGuard, AuthDB, CaptureThePoints, CombatTag, dynmap]
commands: commands:
factions: factions:
description: Reference command for Factions. description: Reference command for Factions.