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>
<scope>provided</scope>
</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>
<repositories>
@ -328,5 +339,9 @@
<id>placeholderapi</id>
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
<repository>
<id>mvdw-software</id>
<url>http://repo.mvdw-software.be/content/groups/public/</url>
</repository>
</repositories>
</project>

View File

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

View File

@ -21,9 +21,12 @@ public abstract class FSidebarProvider {
public String replaceTags(Faction faction, FPlayer fPlayer, String s) {
// Run through Placeholder API first
if (P.p.isPlaceholderAPIHooked() && fPlayer.isOnline()) {
if (P.p.isClipPlaceholderAPIHooked() && fPlayer.isOnline()) {
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));
}

View File

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

View File

@ -2,7 +2,7 @@ name: Factions
version: ${project.version}-b${build.number}
main: com.massivecraft.factions.P
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:
factions:
description: Reference command for Factions.