diff --git a/pom.xml b/pom.xml
index cc37991..cfc524b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -78,6 +78,11 @@
dmulloy2-repo
http://repo.dmulloy2.net/content/groups/public/
+
+
+ placeholderapi
+ http://repo.extendedclip.com/content/repositories/placeholderapi/
+
@@ -390,6 +395,14 @@
12.1
+
+
+ me.clip
+ placeholderapi
+ 2.5.1
+ provided
+
+
junit
diff --git a/src/main/java/com/cnaude/purpleirc/Hooks/PlaceholderApiHook.java b/src/main/java/com/cnaude/purpleirc/Hooks/PlaceholderApiHook.java
new file mode 100644
index 0000000..d7afea9
--- /dev/null
+++ b/src/main/java/com/cnaude/purpleirc/Hooks/PlaceholderApiHook.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2014 cnaude
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package com.cnaude.purpleirc.Hooks;
+
+import me.clip.placeholderapi.PlaceholderAPI;
+import org.bukkit.entity.Player;
+
+/**
+ *
+ * @author Chris Naude
+ */
+public class PlaceholderApiHook {
+
+ public String setPlaceholders(Player player, String message) {
+ if (player != null && message != null) {
+ return PlaceholderAPI.setPlaceholders(player, message);
+ }
+ return "";
+ }
+}
diff --git a/src/main/java/com/cnaude/purpleirc/PurpleIRC.java b/src/main/java/com/cnaude/purpleirc/PurpleIRC.java
index 5a752c4..8ca8267 100644
--- a/src/main/java/com/cnaude/purpleirc/PurpleIRC.java
+++ b/src/main/java/com/cnaude/purpleirc/PurpleIRC.java
@@ -50,6 +50,7 @@ import com.cnaude.purpleirc.Hooks.FactionChatHook;
import com.cnaude.purpleirc.Hooks.GriefPreventionHook;
import com.cnaude.purpleirc.Hooks.JobsHook;
import com.cnaude.purpleirc.Hooks.McMMOChatHook;
+import com.cnaude.purpleirc.Hooks.PlaceholderApiHook;
import com.cnaude.purpleirc.Hooks.VentureChatHook;
import com.cnaude.purpleirc.Hooks.ReportRTSHook;
import com.cnaude.purpleirc.Hooks.ShortifyHook;
@@ -199,6 +200,7 @@ public class PurpleIRC extends JavaPlugin {
public ReportRTSHook reportRTSHook;
public CommandBookHook commandBookHook;
public McMMOChatHook mcMMOChatHook;
+ public PlaceholderApiHook placeholderApiHook;
public NetPackets netPackets;
public CommandHandlers commandHandlers;
public PurpleTabCompleter ircTabCompleter;
@@ -242,6 +244,7 @@ public class PurpleIRC extends JavaPlugin {
final String PL_VENTURECHAT = "VentureChat";
final String PL_HEROCHAT = "Herochat";
final String PL_GRIEFPREVENTION = "GriefPrevention";
+ final String PL_PLACEHOLDERAPI = "PlaceholderAPI";
List hookList = new ArrayList<>();
public static final String PURPLETAG = "UHVycGxlSVJDCg==";
public static final String TOWNYTAG = "VG93bnlDaGF0Cg==";
@@ -1736,6 +1739,12 @@ public class PurpleIRC extends JavaPlugin {
} else {
hookList.add(hookFormat(PL_ESSENTIALS, false));
}
+ if (isPluginEnabled(PL_PLACEHOLDERAPI)) {
+ hookList.add(hookFormat(PL_PLACEHOLDERAPI, true));
+ placeholderApiHook = new PlaceholderApiHook();
+ } else {
+ hookList.add(hookFormat(PL_PLACEHOLDERAPI, false));
+ }
}
public void getPurpleHooks(CommandSender sender, boolean colors) {
diff --git a/src/main/java/com/cnaude/purpleirc/Utilities/ChatTokenizer.java b/src/main/java/com/cnaude/purpleirc/Utilities/ChatTokenizer.java
index 65c62c5..557d3e5 100644
--- a/src/main/java/com/cnaude/purpleirc/Utilities/ChatTokenizer.java
+++ b/src/main/java/com/cnaude/purpleirc/Utilities/ChatTokenizer.java
@@ -976,6 +976,10 @@ public class ChatTokenizer {
}
}
}
+
+ if (plugin.placeholderApiHook != null) {
+ message = plugin.placeholderApiHook.setPlaceholders(player, message);
+ }
plugin.logDebug("[S]Raw message: " + message);
return message.replace("%DISPLAYNAME%", displayName)
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 8f928f0..cfccb9d 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -23,6 +23,7 @@ softdepend:
- SuperVanish
- PremiumVanish
- VanishNoPacket
+- PlaceholderAPI
commands:
irc:
description: Various irc commands