Initial placeholderAPI support.
Give me ideas on what else to add and I'll add it.
This commit is contained in:
parent
24c7107163
commit
fe7002f674
10
pom.xml
10
pom.xml
@ -295,6 +295,12 @@
|
|||||||
<artifactId>PlayerVaults</artifactId>
|
<artifactId>PlayerVaults</artifactId>
|
||||||
<version>3.6.0</version>
|
<version>3.6.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>me.clip</groupId>
|
||||||
|
<artifactId>placeholderapi</artifactId>
|
||||||
|
<version>2.8.2</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
@ -318,5 +324,9 @@
|
|||||||
<id>repo.mikeprimm.com</id>
|
<id>repo.mikeprimm.com</id>
|
||||||
<url>http://repo.mikeprimm.com/</url>
|
<url>http://repo.mikeprimm.com/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>placeholderapi</id>
|
||||||
|
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
</project>
|
</project>
|
||||||
|
@ -58,6 +58,7 @@ public class P extends MPlugin {
|
|||||||
public CmdAutoHelp cmdAutoHelp;
|
public CmdAutoHelp cmdAutoHelp;
|
||||||
|
|
||||||
private boolean hookedPlayervaults;
|
private boolean hookedPlayervaults;
|
||||||
|
private PlaceholderAPIManager placeholderAPIManager;
|
||||||
|
|
||||||
public P() {
|
public P() {
|
||||||
p = this;
|
p = this;
|
||||||
@ -116,10 +117,20 @@ public class P extends MPlugin {
|
|||||||
// since some other plugins execute commands directly through this command interface, provide it
|
// since some other plugins execute commands directly through this command interface, provide it
|
||||||
this.getCommand(this.refCommand).setExecutor(this);
|
this.getCommand(this.refCommand).setExecutor(this);
|
||||||
|
|
||||||
|
setupPlaceholderAPI();
|
||||||
postEnable();
|
postEnable();
|
||||||
this.loadSuccessful = true;
|
this.loadSuccessful = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean setupPermissions() {
|
private boolean setupPermissions() {
|
||||||
try {
|
try {
|
||||||
RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);
|
RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,7 @@ name: Factions
|
|||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
main: com.massivecraft.factions.P
|
main: com.massivecraft.factions.P
|
||||||
authors: [Olof Larsson, Brett Flannigan, drtshock]
|
authors: [Olof Larsson, Brett Flannigan, drtshock]
|
||||||
softdepend: [PlayerVaults, PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, LWC, nChat, ChatManager, CAPI, AuthMe, Vault, Spout, WorldEdit, WorldGuard, AuthDB, CaptureThePoints, CombatTag, dynmap]
|
softdepend: [PlayerVaults, PlaceholderAPI, 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.
|
||||||
|
Loading…
Reference in New Issue
Block a user