mirror of
https://github.com/cnaude/PurpleIRC-spigot.git
synced 2025-01-22 07:21:34 +01:00
mcmmo and placeholderapi fixes
This commit is contained in:
parent
dba1949f80
commit
dad91c24d9
6
pom.xml
6
pom.xml
@ -6,7 +6,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<!-- Bukkit API Version, change if out dated -->
|
||||
<bukkit.version>1.16.4</bukkit.version>
|
||||
<bukkit.version>1.16.5</bukkit.version>
|
||||
<build.number>SNAPSHOT</build.number>
|
||||
</properties>
|
||||
|
||||
@ -285,9 +285,9 @@
|
||||
|
||||
<!-- mcMMO -->
|
||||
<dependency>
|
||||
<groupId>com.gmail.nossr50</groupId>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>1.5.01-SNAPSHOT-b3682</version>
|
||||
<version>2.1.182-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mulitverse-Core -->
|
||||
|
@ -19,6 +19,7 @@ package com.cnaude.purpleirc.GameListeners;
|
||||
import com.cnaude.purpleirc.PurpleBot;
|
||||
import com.cnaude.purpleirc.PurpleIRC;
|
||||
import com.cnaude.purpleirc.TemplateName;
|
||||
import com.gmail.nossr50.datatypes.chat.ChatChannel;
|
||||
import com.gmail.nossr50.events.chat.McMMOAdminChatEvent;
|
||||
import com.gmail.nossr50.events.chat.McMMOChatEvent;
|
||||
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
|
||||
@ -40,7 +41,7 @@ public class McMMOChatListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onMcMMOChatEvent(McMMOChatEvent event) {
|
||||
String sender = event.getSender();
|
||||
String sender = event.getDisplayName(ChatChannel.NONE);
|
||||
Player player = plugin.getServer().getPlayer(sender);
|
||||
if (plugin.adminPrivateChatHook != null) {
|
||||
if (plugin.adminPrivateChatHook.ac.toggledPlayers.contains(player.getName())) {
|
||||
@ -60,7 +61,7 @@ public class McMMOChatListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onMcMMOAdminChatEvent(McMMOAdminChatEvent event) {
|
||||
String sender = event.getSender();
|
||||
String sender = event.getDisplayName(ChatChannel.ADMIN);
|
||||
Player player = plugin.getServer().getPlayer(sender);
|
||||
if (plugin.adminPrivateChatHook != null) {
|
||||
if (plugin.adminPrivateChatHook.ac.toggledPlayers.contains(player.getName())) {
|
||||
@ -80,9 +81,9 @@ public class McMMOChatListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onMcMMOPartyChatEvent(McMMOPartyChatEvent event) {
|
||||
String sender = event.getSender();
|
||||
String sender = event.getDisplayName(ChatChannel.PARTY);
|
||||
Player player = plugin.getServer().getPlayer(sender);
|
||||
String party = event.getParty();
|
||||
String party = event.getAuthorParty().getName();
|
||||
plugin.logDebug("onMcMMOPartyChatEvent caught: " + sender);
|
||||
if (plugin.adminPrivateChatHook != null) {
|
||||
if (plugin.adminPrivateChatHook.ac.toggledPlayers.contains(player.getName())) {
|
||||
|
@ -16,15 +16,10 @@
|
||||
*/
|
||||
package com.cnaude.purpleirc.Hooks;
|
||||
|
||||
import com.cnaude.purpleirc.PurpleBot;
|
||||
import com.cnaude.purpleirc.PurpleIRC;
|
||||
import com.cnaude.purpleirc.TemplateName;
|
||||
import com.gmail.nossr50.api.PartyAPI;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.runnables.party.PartyChatTask;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@ -49,8 +44,7 @@ public class McMMOChatHook {
|
||||
public void sendAdminMessage(String sender, String message) {
|
||||
if (mcMMOPlugin != null) {
|
||||
plugin.logDebug("[mcMMOChatHook:sendAdminMessage]: " + message);
|
||||
String chatPrefix = Config.getInstance().getAdminChatPrefix();
|
||||
message = LocaleLoader.formatString(chatPrefix, sender) + " " + message;
|
||||
message = LocaleLoader.getTextComponent("Chat.Style.Admin", message).content();
|
||||
plugin.broadcastToGame(message, "", "mcmmo.chat.adminchat");
|
||||
}
|
||||
}
|
||||
@ -59,8 +53,10 @@ public class McMMOChatHook {
|
||||
if (mcMMOPlugin != null) {
|
||||
for (Party p : PartyAPI.getParties()) {
|
||||
if (p.getName().equalsIgnoreCase(party)) {
|
||||
plugin.logDebug("[mcMMOChatHook:sendPartyMessage]: " + party + " : " + message);
|
||||
new PartyChatTask(mcMMOPlugin, PartyManager.getParty(party), sender, sender, message).runTask(mcMMOPlugin);
|
||||
message = LocaleLoader.getTextComponent("Chat.Style.Party", message).content();
|
||||
for (Player member : p.getOnlineMembers()) {
|
||||
member.sendMessage(message);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,8 @@
|
||||
package com.cnaude.purpleirc.Hooks;
|
||||
|
||||
import com.cnaude.purpleirc.PurpleIRC;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -25,9 +27,9 @@ import org.bukkit.entity.Player;
|
||||
* @author Chris Naude
|
||||
*/
|
||||
public class PlaceholderApiHook {
|
||||
|
||||
|
||||
private final PurpleIRC plugin;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param plugin the PurpleIRC plugin
|
||||
@ -40,9 +42,15 @@ public class PlaceholderApiHook {
|
||||
String m = message;
|
||||
plugin.logDebug("[setPlaceholders: before] " + m);
|
||||
if (player != null && message != null) {
|
||||
m = PlaceholderAPI.setPlaceholders(player, message);
|
||||
m = PlaceholderAPI.setPlaceholders(player, message);
|
||||
}
|
||||
plugin.logDebug("[setPlaceholders: after] " + m);
|
||||
// put my tokens back toupper case
|
||||
Matcher matcher = Pattern.compile("(%\\w+%)").matcher(m);
|
||||
while (matcher.find()) {
|
||||
m = m.replace(matcher.group(), matcher.group().toUpperCase());
|
||||
}
|
||||
plugin.logDebug("[setPlaceholders: after case fix] " + m);
|
||||
return m;
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ import github.scarsz.discordsrv.DiscordSRV;
|
||||
import java.awt.Color;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@ -1232,7 +1234,7 @@ public class ChatTokenizer {
|
||||
plugin.logDebug("Nick already contains ZWS: " + s);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
if (s.length() > 1) {
|
||||
String a = s.substring(0, 1);
|
||||
String b = s.substring(1);
|
||||
|
Loading…
Reference in New Issue
Block a user