mirror of
https://github.com/cnaude/PurpleIRC-spigot.git
synced 2025-01-07 16:27:43 +01:00
Add PlaceholderAPI support.
This commit is contained in:
parent
d0bc67ba75
commit
1bc82b84e1
13
pom.xml
13
pom.xml
@ -78,6 +78,11 @@
|
||||
<id>dmulloy2-repo</id>
|
||||
<url>http://repo.dmulloy2.net/content/groups/public/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>placeholderapi</id>
|
||||
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
|
||||
@ -390,6 +395,14 @@
|
||||
<version>12.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- PlaceholderAPI -->
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Testing only -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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 "";
|
||||
}
|
||||
}
|
@ -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<String> 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) {
|
||||
|
@ -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)
|
||||
|
@ -23,6 +23,7 @@ softdepend:
|
||||
- SuperVanish
|
||||
- PremiumVanish
|
||||
- VanishNoPacket
|
||||
- PlaceholderAPI
|
||||
commands:
|
||||
irc:
|
||||
description: Various irc commands
|
||||
|
Loading…
Reference in New Issue
Block a user