mirror of
https://github.com/cnaude/PurpleIRC-spigot.git
synced 2025-01-07 16:27:43 +01:00
Add MineverseChat hooks.
This commit is contained in:
parent
0b1eee3989
commit
1258cfa305
@ -197,6 +197,12 @@
|
||||
<version>5.6.7</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cnaude.mineversechat</groupId>
|
||||
<artifactId>MineverseChat</artifactId>
|
||||
<version>2.5.7</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cnaude.jobs</groupId>
|
||||
<artifactId>Jobs</artifactId>
|
||||
|
6
pom.xml
6
pom.xml
@ -170,13 +170,13 @@
|
||||
<version>5.6.7</version>
|
||||
</dependency>
|
||||
|
||||
<!-- MineverseChat
|
||||
<!-- MineverseChat -->
|
||||
<dependency>
|
||||
<groupId>com.cnaude.mineversechat</groupId>
|
||||
<artifactId>MineverseChat</artifactId>
|
||||
<version>2.0</version>
|
||||
<version>2.5.7</version>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
|
||||
<!-- Jobs -->
|
||||
<dependency>
|
||||
|
@ -72,7 +72,7 @@ public class Msg implements IRCCommandInterface {
|
||||
|
||||
for (PurpleBot ircBot : myBots) {
|
||||
String msg = "";
|
||||
final String template = plugin.getMsgTemplate(ircBot.botNick, "", TemplateName.GAME_PCHAT_RESPONSE);
|
||||
final String template = plugin.getMessageTemplate(ircBot.botNick, "", TemplateName.GAME_PCHAT_RESPONSE);
|
||||
for (int i = msgIdx; i < args.length; i++) {
|
||||
msg = msg + " " + args[i];
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public class R implements IRCCommandInterface {
|
||||
+ "/irc msg" + ChatColor.WHITE + " first.");
|
||||
continue;
|
||||
}
|
||||
final String template = plugin.getMsgTemplate(ircBot.botNick, "", TemplateName.GAME_PCHAT_RESPONSE);
|
||||
final String template = plugin.getMessageTemplate(ircBot.botNick, "", TemplateName.GAME_PCHAT_RESPONSE);
|
||||
for (int i = 1; i < args.length; i++) {
|
||||
msg = msg + " " + args[i];
|
||||
}
|
||||
|
@ -78,9 +78,9 @@ public class SMsg implements IRCCommandInterface {
|
||||
|
||||
if (plugin.getServer().getPlayer(target) instanceof Player) {
|
||||
Player targetPlayer = plugin.getServer().getPlayer(target);
|
||||
String template = plugin.getMsgTemplate("MAIN", "", TemplateName.GAME_PCHAT);
|
||||
String template = plugin.getMessageTemplate("MAIN", "", TemplateName.GAME_PCHAT);
|
||||
String targetMsg = plugin.tokenizer.gameChatTokenizer(sender, target, template, msg);
|
||||
String responseTemplate = plugin.getMsgTemplate("MAIN", "", TemplateName.GAME_PCHAT_RESPONSE);
|
||||
String responseTemplate = plugin.getMessageTemplate("MAIN", "", TemplateName.GAME_PCHAT_RESPONSE);
|
||||
if (!responseTemplate.isEmpty()) {
|
||||
String responseMsg = plugin.tokenizer.msgChatResponseTokenizer(sender, targetPlayer, msg, responseTemplate);
|
||||
sender.sendMessage(responseMsg);
|
||||
@ -118,7 +118,7 @@ public class SMsg implements IRCCommandInterface {
|
||||
}
|
||||
|
||||
if (ircBot.botLinkingEnabled) {
|
||||
final String template = plugin.getMsgTemplate(ircBot.botNick, "", TemplateName.GAME_PCHAT_RESPONSE);
|
||||
final String template = plugin.getMessageTemplate(ircBot.botNick, "", TemplateName.GAME_PCHAT_RESPONSE);
|
||||
ircBot.msgRemotePlayer(sender, remoteBot, remotePlayer, msg);
|
||||
if (!template.isEmpty()) {
|
||||
sender.sendMessage(plugin.tokenizer.msgChatResponseTokenizer(sender, target, msg, template));
|
||||
|
@ -49,9 +49,6 @@ public class GamePlayerChatListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onAsyncPlayerChat(AsyncPlayerChatEvent event) {
|
||||
String message = event.getMessage();
|
||||
//if(plugin.isPluginEnabled("GriefPrevention")) {
|
||||
// return;
|
||||
//}
|
||||
plugin.logDebug("ChatFormat [" + event.isCancelled() + "]: " + event.getFormat());
|
||||
if (message.startsWith(PurpleIRC.TOWNYTAG)) {
|
||||
event.setMessage(message.replace(PurpleIRC.TOWNYTAG, ""));
|
||||
@ -72,7 +69,7 @@ public class GamePlayerChatListener implements Listener {
|
||||
if (event.getPlayer().hasPermission("irc.message.gamechat")) {
|
||||
plugin.logDebug("Player " + event.getPlayer().getName() + " has permission irc.message.gamechat");
|
||||
for (PurpleBot ircBot : plugin.ircBots.values()) {
|
||||
ircBot.gameChat(event.getPlayer(), event.getMessage());
|
||||
ircBot.gameChat(event);
|
||||
}
|
||||
} else {
|
||||
plugin.logDebug("Player " + event.getPlayer().getName() + " does not have irc.message.gamechat permission.");
|
||||
|
@ -74,7 +74,7 @@ public class JobsHook {
|
||||
}
|
||||
}
|
||||
if (!j.isEmpty()) {
|
||||
return Joiner.on(plugin.getMsgTemplate(TemplateName.JOBS_SEPARATOR)).join(j);
|
||||
return Joiner.on(plugin.getMessageTemplate(TemplateName.JOBS_SEPARATOR)).join(j);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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 com.cnaude.purpleirc.PurpleIRC;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cnaude
|
||||
*/
|
||||
public class MineverseChatHook {
|
||||
|
||||
private final PurpleIRC plugin;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param plugin the PurpleIRC plugin
|
||||
*/
|
||||
public MineverseChatHook(PurpleIRC plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
}
|
||||
|
||||
public void sendMessage(String channel, String message) {
|
||||
if (channel.isEmpty() || message.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
MineverseChatPlayer mcp = MineverseChatAPI.getMineverseChatPlayer(player);
|
||||
if (mcp != null) {
|
||||
for (String listen : mcp.getListening()) {
|
||||
if (listen.equalsIgnoreCase(channel)) {
|
||||
plugin.broadcastToPlayer(player, message, "irc.message.chat");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -112,7 +112,7 @@ public class TownyChatHook {
|
||||
String townyChannelName = chat.getChannelsHandler().getActiveChannel(player, ct).getName();
|
||||
if (townyChannel.equalsIgnoreCase(townyChannelName)) {
|
||||
plugin.logDebug("TC [" + townyChannelName + "]: Sending message to " + player + ": " + message);
|
||||
player.sendMessage(message);
|
||||
player.sendMessage(message.replace("\u200B", ""));
|
||||
break;
|
||||
} else {
|
||||
plugin.logDebug("TC " + townyChannelName + "]: invalid TC channel name for " + player);
|
||||
@ -137,7 +137,7 @@ public class TownyChatHook {
|
||||
|| ircBot.isMessageEnabled(channelName, TemplateName.TOWNY_CHANNEL_CHAT)) {
|
||||
ircBot.asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.chatTownyChannelTokenizer(player, townyChannel, message,
|
||||
plugin.getMsgTemplate(ircBot.botNick, channelName, TemplateName.TOWNY_CHANNEL_CHAT)));
|
||||
plugin.getMessageTemplate(ircBot.botNick, channelName, TemplateName.TOWNY_CHANNEL_CHAT)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class NickChangeListener extends ListenerAdapter {
|
||||
if (channel != null) {
|
||||
if (ircBot.enabledMessages.get(channelName).contains(TemplateName.IRC_NICK_CHANGE)) {
|
||||
plugin.broadcastToGame(plugin.colorConverter.ircColorsToGame(
|
||||
plugin.getMsgTemplate(ircBot.botNick, channelName, TemplateName.IRC_NICK_CHANGE)
|
||||
plugin.getMessageTemplate(ircBot.botNick, channelName, TemplateName.IRC_NICK_CHANGE)
|
||||
.replace("%NEWNICK%", newNick)
|
||||
.replace("%OLDNICK%", oldNick)
|
||||
.replace("%CHANNEL%", channelName)), "irc.message.nickchange");
|
||||
|
@ -58,7 +58,7 @@ public class TopicListener extends ListenerAdapter {
|
||||
if (event.isChanged()) {
|
||||
if (ircBot.enabledMessages.get(channel.getName()).contains(TemplateName.IRC_TOPIC)) {
|
||||
String message = plugin.colorConverter.ircColorsToGame(
|
||||
plugin.getMsgTemplate(ircBot.botNick, channelName, TemplateName.IRC_TOPIC)
|
||||
plugin.getMessageTemplate(ircBot.botNick, channelName, TemplateName.IRC_TOPIC)
|
||||
.replace("%NAME%", user.getNick())
|
||||
.replace("%TOPIC%", event.getTopic())
|
||||
.replace("%CHANNEL%", channel.getName()));
|
||||
|
@ -47,7 +47,7 @@ public class IRCMessageHandler {
|
||||
}
|
||||
|
||||
private void sendFloodWarning(User user, PurpleBot ircBot) {
|
||||
String message = plugin.colorConverter.gameColorsToIrc(plugin.getMsgTemplate(
|
||||
String message = plugin.colorConverter.gameColorsToIrc(plugin.getMessageTemplate(
|
||||
ircBot.botNick, "", TemplateName.IRC_FLOOD_WARNING)
|
||||
.replace("%COOLDOWN%", ircBot.floodChecker.getCoolDown(user)));
|
||||
if (!message.isEmpty()) {
|
||||
@ -184,9 +184,9 @@ public class IRCMessageHandler {
|
||||
case "@a":
|
||||
if (plugin.adminPrivateChatHook != null) {
|
||||
String newMessage = ircBot.filterMessage(
|
||||
plugin.tokenizer.ircChatToGameTokenizer(ircBot, user, channel, plugin.getMsgTemplate(ircBot.botNick, channelName, TemplateName.IRC_ADMIN_CHAT), commandArgs), channelName);
|
||||
plugin.tokenizer.ircChatToGameTokenizer(ircBot, user, channel, plugin.getMessageTemplate(ircBot.botNick, channelName, TemplateName.IRC_ADMIN_CHAT), commandArgs), channelName);
|
||||
plugin.adminPrivateChatHook.sendMessage(newMessage, user.getNick());
|
||||
String acResponse = plugin.tokenizer.msgChatResponseTokenizer(target, commandArgs, plugin.getMsgTemplate(TemplateName.IRC_ADMIN_RESPONSE));
|
||||
String acResponse = plugin.tokenizer.msgChatResponseTokenizer(target, commandArgs, plugin.getMessageTemplate(TemplateName.IRC_ADMIN_RESPONSE));
|
||||
if (!acResponse.isEmpty()) {
|
||||
sendMessage(ircBot, target, acResponse, ctcpResponse);
|
||||
}
|
||||
@ -247,7 +247,7 @@ public class IRCMessageHandler {
|
||||
}
|
||||
} else {
|
||||
plugin.logDebug("User '" + user.getNick() + "' mode not okay.");
|
||||
ircBot.asyncIRCMessage(target, plugin.getMsgTemplate(
|
||||
ircBot.asyncIRCMessage(target, plugin.getMessageTemplate(
|
||||
ircBot.botNick, channelName, TemplateName.NO_PERM_FOR_IRC_COMMAND)
|
||||
.replace("%NICK%", user.getNick())
|
||||
.replace("%CMDPREFIX%", ircBot.commandPrefix));
|
||||
@ -257,7 +257,7 @@ public class IRCMessageHandler {
|
||||
target = user.getNick();
|
||||
}
|
||||
plugin.logDebug("Invalid command: " + command);
|
||||
String invalidIrcCommand = plugin.getMsgTemplate(
|
||||
String invalidIrcCommand = plugin.getMessageTemplate(
|
||||
ircBot.botNick, channelName, TemplateName.INVALID_IRC_COMMAND)
|
||||
.replace("%NICK%", user.getNick())
|
||||
.replace("%CMDPREFIX%", ircBot.commandPrefix);
|
||||
@ -332,7 +332,7 @@ public class IRCMessageHandler {
|
||||
}
|
||||
Collections.sort(sortedCommands, Collator.getInstance());
|
||||
String cmds = Joiner.on(", ").join(sortedCommands);
|
||||
String msg = plugin.getMsgTemplate(TemplateName.VALID_IRC_COMMANDS).replace("%COMMANDS%", cmds);
|
||||
String msg = plugin.getMessageTemplate(TemplateName.VALID_IRC_COMMANDS).replace("%COMMANDS%", cmds);
|
||||
return msg;
|
||||
}
|
||||
return "";
|
||||
|
@ -92,21 +92,25 @@ public class IRCMessageQueueWatcher {
|
||||
}
|
||||
|
||||
private String pingFix(String message) {
|
||||
for (Channel channel : ircBot.bot.getUserBot().getChannels()) {
|
||||
for (User user : channel.getUsers()) {
|
||||
if (user.getNick().equalsIgnoreCase(ircBot.botNick)) {
|
||||
continue;
|
||||
}
|
||||
if (message.toLowerCase().contains(user.getNick().toLowerCase())) {
|
||||
message = message.replaceAll("(?i)" + user.getNick(), plugin.tokenizer.addZeroWidthSpace(user.getNick()));
|
||||
plugin.logDebug("Adding ZWS to " + user.getNick());
|
||||
try {
|
||||
for (Channel channel : ircBot.bot.getUserBot().getChannels()) {
|
||||
for (User user : channel.getUsers()) {
|
||||
if (user.getNick().equalsIgnoreCase(ircBot.botNick)) {
|
||||
continue;
|
||||
}
|
||||
if (message.toLowerCase().contains(user.getNick().toLowerCase())) {
|
||||
message = message.replaceAll("(?i)" + user.getNick(), plugin.tokenizer.addZeroWidthSpace(user.getNick()));
|
||||
plugin.logDebug("Adding ZWS to " + user.getNick());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
plugin.logDebug(ex.getMessage());
|
||||
}
|
||||
return message ;
|
||||
}
|
||||
|
||||
private String[] cleanupAndSplitMessage(String message) {
|
||||
private String[] cleanupAndSplitMessage(String message) {
|
||||
if (ircBot.pingFixFull) {
|
||||
message = pingFix(message);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class LogTailer {
|
||||
okayToSend = true;
|
||||
}
|
||||
if (okayToSend && !excludesMatch(line)) {
|
||||
String template = plugin.getMsgTemplate(ircBot.botNick, target, TemplateName.LOG_TAILER);
|
||||
String template = plugin.getMessageTemplate(ircBot.botNick, target, TemplateName.LOG_TAILER);
|
||||
String message = plugin.tokenizer.logTailerTokenizer(file.getName(), line, template);
|
||||
if (ctcp) {
|
||||
blockingCTCPMessage(target, message);
|
||||
|
@ -59,6 +59,9 @@ import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import me.botsko.prism.actionlibs.QueryParameters;
|
||||
import me.botsko.prism.events.BlockStateChange;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import org.bukkit.Achievement;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
@ -66,6 +69,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.pircbotx.Channel;
|
||||
import org.pircbotx.Configuration;
|
||||
import org.pircbotx.PircBotX;
|
||||
@ -143,10 +147,12 @@ public final class PurpleBot {
|
||||
public CaseInsensitiveMap<Boolean> invalidCommandPrivate;
|
||||
public CaseInsensitiveMap<Boolean> invalidCommandCTCP;
|
||||
public CaseInsensitiveMap<Boolean> logIrcToHeroChat;
|
||||
public CaseInsensitiveMap<Boolean> logIrcToMineverseChat;
|
||||
public CaseInsensitiveMap<Boolean> enableMessageFiltering;
|
||||
public CaseInsensitiveMap<String> channelPrefix;
|
||||
private final CaseInsensitiveMap<Boolean> shortify;
|
||||
public CaseInsensitiveMap<String> heroChannel;
|
||||
public CaseInsensitiveMap<String> mineverseChannel;
|
||||
public CaseInsensitiveMap<String> townyChannel;
|
||||
public CaseInsensitiveMap<Collection<String>> opsList;
|
||||
public CaseInsensitiveMap<Collection<String>> banList;
|
||||
@ -228,9 +234,11 @@ public final class PurpleBot {
|
||||
this.banList = new CaseInsensitiveMap<>();
|
||||
this.voicesList = new CaseInsensitiveMap<>();
|
||||
this.heroChannel = new CaseInsensitiveMap<>();
|
||||
this.mineverseChannel = new CaseInsensitiveMap<>();
|
||||
this.townyChannel = new CaseInsensitiveMap<>();
|
||||
this.invalidCommandCTCP = new CaseInsensitiveMap<>();
|
||||
this.logIrcToHeroChat = new CaseInsensitiveMap<>();
|
||||
this.logIrcToMineverseChat = new CaseInsensitiveMap<>();
|
||||
this.shortify = new CaseInsensitiveMap<>();
|
||||
this.invalidCommandPrivate = new CaseInsensitiveMap<>();
|
||||
this.hideQuitWhenVanished = new CaseInsensitiveMap<>();
|
||||
@ -846,14 +854,14 @@ public final class PurpleBot {
|
||||
if (channelCmdNotifyIgnore.isEmpty()) {
|
||||
plugin.logInfo(" No command-notify ignores defined.");
|
||||
}
|
||||
|
||||
|
||||
// build tailer filter list
|
||||
for (String re : config.getStringList("file-tailer.excludes")) {
|
||||
if (!tailerFilters.contains(re)) {
|
||||
tailerFilters.add(re);
|
||||
}
|
||||
plugin.logDebug("Filtered from tailer => " + re);
|
||||
}
|
||||
}
|
||||
if (tailerFilters.isEmpty()) {
|
||||
plugin.logInfo("Tailer filter list is empty!");
|
||||
}
|
||||
@ -888,14 +896,20 @@ public final class PurpleBot {
|
||||
channelTopicChanserv.put(channelName, config.getBoolean("channels." + enChannelName + ".topic-chanserv", false));
|
||||
plugin.logDebug(" Topic Chanserv Mode => " + channelTopicChanserv.get(channelName).toString());
|
||||
|
||||
heroChannel.put(channelName, config.getString("channels." + enChannelName + ".hero-channel", ""));
|
||||
heroChannel.put(channelName, config.getString("channels." + enChannelName + ".hero-channel", "admin"));
|
||||
plugin.logDebug(" HeroChannel => " + heroChannel.get(channelName));
|
||||
|
||||
mineverseChannel.put(channelName, config.getString("channels." + enChannelName + ".mineverse-channel", "global"));
|
||||
plugin.logDebug(" MineverseChannel => " + mineverseChannel.get(channelName));
|
||||
|
||||
townyChannel.put(channelName, config.getString("channels." + enChannelName + ".towny-channel", ""));
|
||||
plugin.logDebug(" TownyChannel => " + townyChannel.get(channelName));
|
||||
|
||||
logIrcToHeroChat.put(channelName, config.getBoolean("channels." + enChannelName + ".log-irc-to-hero-chat", false));
|
||||
plugin.logDebug(" LogIrcToHeroChat => " + logIrcToHeroChat.get(channelName));
|
||||
|
||||
logIrcToMineverseChat.put(channelName, config.getBoolean("channels." + enChannelName + ".log-irc-to-mineverse-chat", false));
|
||||
plugin.logDebug(" LogIrcToMineverseChat => " + logIrcToMineverseChat.get(channelName));
|
||||
|
||||
ignoreIRCChat.put(channelName, config.getBoolean("channels." + enChannelName + ".ignore-irc-chat", false));
|
||||
plugin.logDebug(" IgnoreIRCChat => " + ignoreIRCChat.get(channelName));
|
||||
@ -1159,10 +1173,11 @@ public final class PurpleBot {
|
||||
/**
|
||||
* Called from normal game chat listener
|
||||
*
|
||||
* @param player
|
||||
* @param message
|
||||
* @param event
|
||||
*/
|
||||
public void gameChat(Player player, String message) {
|
||||
public void gameChat(AsyncPlayerChatEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
String message = event.getMessage();
|
||||
if (!this.isConnected()) {
|
||||
return;
|
||||
}
|
||||
@ -1207,16 +1222,19 @@ public final class PurpleBot {
|
||||
} else {
|
||||
plugin.logDebug("No Factions");
|
||||
}
|
||||
if (plugin.mineverseChatEnabled) {
|
||||
mineverseChat(event);
|
||||
}
|
||||
if (isMessageEnabled(channelName, TemplateName.GAME_CHAT)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.gameChatToIRCTokenizer(player, plugin.getMsgTemplate(botNick, channelName, TemplateName.GAME_CHAT), message));
|
||||
.gameChatToIRCTokenizer(player, plugin.getMessageTemplate(botNick, channelName, TemplateName.GAME_CHAT), message));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sendFloodWarning(Player player) {
|
||||
String message = plugin.getMsgTemplate(botNick, "", TemplateName.GAME_FLOOD_WARNING)
|
||||
String message = plugin.getMessageTemplate(botNick, "", TemplateName.GAME_FLOOD_WARNING)
|
||||
.replace("%COOLDOWN%", floodChecker.getCoolDown(player));
|
||||
if (!message.isEmpty()) {
|
||||
player.sendMessage(message);
|
||||
@ -1249,7 +1267,7 @@ public final class PurpleBot {
|
||||
|| isMessageEnabled(channelName, TemplateName.HERO_CHAT)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.chatHeroTokenizer(player, message, hColor, hChannel,
|
||||
hNick, plugin.getHeroChatChannelTemplate(botNick, hChannel)));
|
||||
hNick, plugin.getHeroChatTemplate(botNick, hChannel)));
|
||||
} else {
|
||||
plugin.logDebug("Player " + player.getName() + " is in \""
|
||||
+ hChannel + "\" but hero-" + hChannel + "-chat is disabled.");
|
||||
@ -1272,7 +1290,7 @@ public final class PurpleBot {
|
||||
plugin.logDebug("Sending message because " + TemplateName.MCMMO_ADMIN_CHAT + " is enabled.");
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.mcMMOChatToIRCTokenizer(player, plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.MCMMO_ADMIN_CHAT), message));
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.MCMMO_ADMIN_CHAT), message));
|
||||
} else {
|
||||
plugin.logDebug("Player " + player.getName()
|
||||
+ " is in mcMMO AdminChat but " + TemplateName.MCMMO_ADMIN_CHAT + " is disabled.");
|
||||
@ -1295,7 +1313,7 @@ public final class PurpleBot {
|
||||
plugin.logDebug("Sending message because " + TemplateName.MCMMO_PARTY_CHAT + " is enabled.");
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.mcMMOPartyChatToIRCTokenizer(player, plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.MCMMO_PARTY_CHAT), message, partyName));
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.MCMMO_PARTY_CHAT), message, partyName));
|
||||
} else {
|
||||
plugin.logDebug("Player " + player.getName()
|
||||
+ " is in mcMMO PartyChat but " + TemplateName.MCMMO_PARTY_CHAT + " is disabled.");
|
||||
@ -1318,7 +1336,7 @@ public final class PurpleBot {
|
||||
plugin.logDebug("Sending message because " + TemplateName.MCMMO_CHAT + " is enabled.");
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.mcMMOChatToIRCTokenizer(player, plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.MCMMO_CHAT), message));
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.MCMMO_CHAT), message));
|
||||
} else {
|
||||
plugin.logDebug("Player " + player.getName()
|
||||
+ " is in mcMMO Chat but " + TemplateName.MCMMO_CHAT + " is disabled.");
|
||||
@ -1348,7 +1366,7 @@ public final class PurpleBot {
|
||||
|| isMessageEnabled(channelName, "hero-action")) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.chatHeroTokenizer(player, message, hColor, hChannel,
|
||||
hNick, plugin.getHeroActionChannelTemplate(botNick, hChannel)));
|
||||
hNick, plugin.getHeroActionTemplate(botNick, hChannel)));
|
||||
} else {
|
||||
plugin.logDebug("Player " + player.getName() + " is in \""
|
||||
+ hChannel + "\" but hero-" + hChannel + "-action is disabled.");
|
||||
@ -1356,8 +1374,50 @@ public final class PurpleBot {
|
||||
}
|
||||
}
|
||||
|
||||
// Called from TitanChat listener
|
||||
/**
|
||||
* MineverseChat from game to IRC
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
public void mineverseChat(AsyncPlayerChatEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
MineverseChatPlayer mcp = MineverseChatAPI.getMineverseChatPlayer(event.getPlayer());
|
||||
ChatChannel eventChannel = mcp.getCurrentChannel();
|
||||
if (mcp.isQuickChat()) { //for single message chat detection
|
||||
eventChannel = mcp.getQuickChannel();
|
||||
}
|
||||
if (!this.isConnected()) {
|
||||
return;
|
||||
}
|
||||
if (floodChecker.isSpam(player)) {
|
||||
sendFloodWarning(player);
|
||||
return;
|
||||
}
|
||||
String mvChannel = eventChannel.getName();
|
||||
String mvColor = eventChannel.getColor();
|
||||
String message = event.getMessage();
|
||||
for (String channelName : botChannels) {
|
||||
if (!isPlayerInValidWorld(player, channelName)) {
|
||||
continue;
|
||||
}
|
||||
plugin.logDebug("MV Channel: " + mvChannel);
|
||||
String channelTemplateName = "mineverse-" + mvChannel + "-chat";
|
||||
if (isMessageEnabled(channelName, channelTemplateName)
|
||||
|| isMessageEnabled(channelName, TemplateName.MINEVERSE_CHAT)) {
|
||||
String template = plugin.getMineverseChatTemplate(botNick, mvChannel);
|
||||
plugin.logDebug("MV Template: " + template);
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.mineverseChatTokenizer(player, mvChannel, mvColor, message, template));
|
||||
} else {
|
||||
plugin.logDebug("Player " + player.getName() + " is in Mineverse channel "
|
||||
+ mvChannel + ". Message types " + channelTemplateName + " and "
|
||||
+ TemplateName.MINEVERSE_CHAT + " are disabled. No message sent to IRC.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from TitanChat listener
|
||||
*
|
||||
* @param participant
|
||||
* @param tChannel
|
||||
@ -1382,7 +1442,7 @@ public final class PurpleBot {
|
||||
|| isMessageEnabled(channelName, "titan-chat")) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.titanChatTokenizer(player, tChannel, tColor, message,
|
||||
plugin.getMsgTemplate(botNick, channelName, TemplateName.TITAN_CHAT)));
|
||||
plugin.getMessageTemplate(botNick, channelName, TemplateName.TITAN_CHAT)));
|
||||
} else {
|
||||
plugin.logDebug("Player " + player.getName() + " is in \""
|
||||
+ tChannel + "\" but titan-" + tChannel + "-chat is disabled.");
|
||||
@ -1404,7 +1464,7 @@ public final class PurpleBot {
|
||||
if (isValidChannel(channelName)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.gameChatToIRCTokenizer(player, plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.GAME_SEND), message));
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.GAME_SEND), message));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1422,7 +1482,7 @@ public final class PurpleBot {
|
||||
if (isMessageEnabled(channelName, "clever-chat")) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.gameChatToIRCTokenizer(cleverBotName, plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.CLEVER_SEND), message));
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.CLEVER_SEND), message));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1441,8 +1501,7 @@ public final class PurpleBot {
|
||||
for (String channelName : botChannels) {
|
||||
if (isMessageEnabled(channelName, TemplateName.GAME_ADMIN_CHAT)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.gameChatToIRCTokenizer(name, plugin.
|
||||
getMsgTemplate(botNick, channelName, TemplateName.GAME_ADMIN_CHAT), message)
|
||||
.gameChatToIRCTokenizer(name, plugin.getMessageTemplate(botNick, channelName, TemplateName.GAME_ADMIN_CHAT), message)
|
||||
.replace("%WORLD%", world)
|
||||
);
|
||||
}
|
||||
@ -1466,7 +1525,7 @@ public final class PurpleBot {
|
||||
if (isMessageEnabled(channelName, messageType)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.reportRTSTokenizer(pName, plugin
|
||||
.getMsgTemplate(botNick, channelName, messageType), ticket));
|
||||
.getMessageTemplate(botNick, channelName, messageType), ticket));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1478,7 +1537,7 @@ public final class PurpleBot {
|
||||
for (String channelName : botChannels) {
|
||||
if (isMessageEnabled(channelName, messageType)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.reportRTSTokenizer(sender, message, plugin.getMsgTemplate(botNick, channelName, messageType)));
|
||||
.reportRTSTokenizer(sender, message, plugin.getMessageTemplate(botNick, channelName, messageType)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1493,7 +1552,7 @@ public final class PurpleBot {
|
||||
asyncIRCMessage(
|
||||
channelName,
|
||||
plugin.tokenizer.gameChatToIRCTokenizer(
|
||||
plugin.getMsgTemplate(botNick, channelName, messageType),
|
||||
plugin.getMessageTemplate(botNick, channelName, messageType),
|
||||
message));
|
||||
}
|
||||
}
|
||||
@ -1512,7 +1571,7 @@ public final class PurpleBot {
|
||||
if (isValidChannel(channelName)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.gameChatToIRCTokenizer("CONSOLE", message, plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.GAME_SEND)));
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.GAME_SEND)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1528,7 +1587,7 @@ public final class PurpleBot {
|
||||
if (isMessageEnabled(channelName, TemplateName.CONSOLE_CHAT)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.gameChatToIRCTokenizer(plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.CONSOLE_CHAT),
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.CONSOLE_CHAT),
|
||||
ChatColor.translateAlternateColorCodes('&', message)));
|
||||
}
|
||||
}
|
||||
@ -1551,7 +1610,7 @@ public final class PurpleBot {
|
||||
if (isMessageEnabled(channelName, TemplateName.BROADCAST_MESSAGE)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.gameChatToIRCTokenizer(player, plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.BROADCAST_MESSAGE),
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.BROADCAST_MESSAGE),
|
||||
ChatColor.translateAlternateColorCodes('&', message)));
|
||||
}
|
||||
}
|
||||
@ -1570,7 +1629,7 @@ public final class PurpleBot {
|
||||
if (isMessageEnabled(channelName, TemplateName.ESS_HELPOP)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.gameChatToIRCTokenizer(player, plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.ESS_HELPOP),
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.ESS_HELPOP),
|
||||
ChatColor.translateAlternateColorCodes('&', message)));
|
||||
}
|
||||
}
|
||||
@ -1589,7 +1648,7 @@ public final class PurpleBot {
|
||||
if (isMessageEnabled(channelName, TemplateName.ORE_BROADCAST)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.gameChatToIRCTokenizer(player, plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.ORE_BROADCAST),
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.ORE_BROADCAST),
|
||||
ChatColor.translateAlternateColorCodes('&', message)));
|
||||
}
|
||||
}
|
||||
@ -1611,7 +1670,7 @@ public final class PurpleBot {
|
||||
plugin.logDebug("dynmapWebChat: sending message");
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.dynmapWebChatToIRCTokenizer(source, name, plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.DYNMAP_WEB_CHAT),
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.DYNMAP_WEB_CHAT),
|
||||
ChatColor.translateAlternateColorCodes('&', message)));
|
||||
}
|
||||
}
|
||||
@ -1629,7 +1688,7 @@ public final class PurpleBot {
|
||||
if (isMessageEnabled(channelName, TemplateName.BROADCAST_CONSOLE_MESSAGE)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.gameChatToIRCTokenizer(plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.BROADCAST_CONSOLE_MESSAGE),
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.BROADCAST_CONSOLE_MESSAGE),
|
||||
ChatColor.translateAlternateColorCodes('&', message)));
|
||||
}
|
||||
}
|
||||
@ -1647,7 +1706,7 @@ public final class PurpleBot {
|
||||
if (isMessageEnabled(channelName, TemplateName.REDDIT_MESSAGES)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.gameChatToIRCTokenizer(plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.REDDIT_MESSAGES), message));
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.REDDIT_MESSAGES), message));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1671,12 +1730,12 @@ public final class PurpleBot {
|
||||
&& !player.hasPlayedBefore()) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.gameChatToIRCTokenizer(this, channelName, player, plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.GAME_FIRST_JOIN), message));
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.GAME_FIRST_JOIN), message));
|
||||
} else if (isMessageEnabled(channelName, TemplateName.GAME_JOIN)
|
||||
&& isPlayerInValidWorld(player, channelName)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.gameChatToIRCTokenizer(this, channelName, player, plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.GAME_JOIN), message));
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.GAME_JOIN), message));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1700,7 +1759,7 @@ public final class PurpleBot {
|
||||
&& isPlayerInValidWorld(player, channelName)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.gameChatToIRCTokenizer(this, channelName, player, plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.GAME_QUIT), message));
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.GAME_QUIT), message));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1719,7 +1778,7 @@ public final class PurpleBot {
|
||||
&& isPlayerInValidWorld(player, channelName)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.gameChatToIRCTokenizer(this, channelName, player, plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.FAKE_JOIN), message));
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.FAKE_JOIN), message));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1738,7 +1797,7 @@ public final class PurpleBot {
|
||||
&& isPlayerInValidWorld(player, channelName)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.gameChatToIRCTokenizer(this, channelName, player, plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.FAKE_QUIT), message));
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.FAKE_QUIT), message));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1758,7 +1817,7 @@ public final class PurpleBot {
|
||||
&& isPlayerInValidWorld(player, channelName)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.gameChatToIRCTokenizer(player, plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.GAME_ACHIEVEMENT), message));
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.GAME_ACHIEVEMENT), message));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1778,7 +1837,7 @@ public final class PurpleBot {
|
||||
&& isPlayerInValidWorld(player, channelName)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.gameChatToIRCTokenizer(player, plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.GAME_MODE), message));
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.GAME_MODE), message));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1798,7 +1857,7 @@ public final class PurpleBot {
|
||||
&& isPlayerInValidWorld(player, channelName)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.gameKickTokenizer(player, plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.GAME_KICK), message, reason));
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.GAME_KICK), message, reason));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1824,7 +1883,7 @@ public final class PurpleBot {
|
||||
&& isPlayerInValidWorld(player, channelName)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.gameChatToIRCTokenizer(player, plugin
|
||||
.getMsgTemplate(botNick, channelName, TemplateName.GAME_ACTION), message));
|
||||
.getMessageTemplate(botNick, channelName, TemplateName.GAME_ACTION), message));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1851,7 +1910,7 @@ public final class PurpleBot {
|
||||
if (isPlayerInValidWorld(player, channelName)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.gameChatToIRCTokenizer(player, plugin
|
||||
.getMsgTemplate(botNick, channelName, templateName), message));
|
||||
.getMessageTemplate(botNick, channelName, templateName), message));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2626,7 +2685,7 @@ public final class PurpleBot {
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
|
||||
// Broadcast chat messages from IRC to the game
|
||||
/**
|
||||
*
|
||||
@ -2663,10 +2722,10 @@ public final class PurpleBot {
|
||||
if (enabledMessages.get(channelName).contains(TemplateName.IRC_DYNMAP_WEB_CHAT)) {
|
||||
plugin.logDebug("Yes, " + TemplateName.IRC_DYNMAP_WEB_CHAT + " is enabled...");
|
||||
plugin.logDebug("broadcastChat [DW]: " + message);
|
||||
String template = plugin.getMsgTemplate(botNick, channelName, TemplateName.IRC_DYNMAP_WEB_CHAT);
|
||||
String template = plugin.getMessageTemplate(botNick, channelName, TemplateName.IRC_DYNMAP_WEB_CHAT);
|
||||
String rawDWMessage = filterMessage(
|
||||
plugin.tokenizer.ircChatToGameTokenizer(this, user, channel, template, message), channelName);
|
||||
String nickTmpl = plugin.getMsgTemplate(botNick, channelName, TemplateName.IRC_DYNMAP_NICK);
|
||||
String nickTmpl = plugin.getMessageTemplate(botNick, channelName, TemplateName.IRC_DYNMAP_NICK);
|
||||
String rawNick = nickTmpl.replace("%NICK%", user.getNick());
|
||||
plugin.dynmapHook.sendMessage(rawNick, rawDWMessage);
|
||||
messageSent = true;
|
||||
@ -2683,7 +2742,7 @@ public final class PurpleBot {
|
||||
if (townyChannel.containsKey(channelName)) {
|
||||
String tChannel = townyChannel.get(channelName);
|
||||
if (!tChannel.isEmpty()) {
|
||||
String tmpl = plugin.getIRCTownyChatChannelTemplate(botNick, tChannel);
|
||||
String tmpl = plugin.getIrcTownyChatTemplate(botNick, tChannel);
|
||||
plugin.logDebug("broadcastChat [TC]: " + tChannel + ": " + tmpl);
|
||||
String rawTCMessage = filterMessage(
|
||||
plugin.tokenizer.ircChatToTownyChatTokenizer(this, user, channel, tmpl, message, tChannel), channelName);
|
||||
@ -2702,7 +2761,7 @@ public final class PurpleBot {
|
||||
Send to mcMMMO admin channel if enabled
|
||||
*/
|
||||
if (isMessageEnabled(channelName, TemplateName.IRC_MCMMO_ADMIN_CHAT)) {
|
||||
String tmpl = plugin.getMsgTemplate(botNick, channelName, TemplateName.IRC_MCMMO_ADMIN_CHAT);
|
||||
String tmpl = plugin.getMessageTemplate(botNick, channelName, TemplateName.IRC_MCMMO_ADMIN_CHAT);
|
||||
plugin.logDebug("broadcastChat [mcMMO:admin]: " + message);
|
||||
String rawMcMMOMessage = filterMessage(
|
||||
plugin.tokenizer.ircChatToGameTokenizer(this, user, channel, tmpl, message), channelName);
|
||||
@ -2718,7 +2777,7 @@ public final class PurpleBot {
|
||||
if (isMessageEnabled(channelName, em)) {
|
||||
String party = em.replace("irc-mcmmo-party-", "").replace("-chat", "");
|
||||
if (!party.isEmpty()) {
|
||||
String tmpl = plugin.getMsgTemplate(botNick, channelName, TemplateName.IRC_MCMMO_PARTY_CHAT);
|
||||
String tmpl = plugin.getMessageTemplate(botNick, channelName, TemplateName.IRC_MCMMO_PARTY_CHAT);
|
||||
plugin.logDebug("broadcastChat [mcMMO:party]: " + party + " : " + message);
|
||||
String rawMcMMOMessage = filterMessage(
|
||||
plugin.tokenizer.ircChatToGameTokenizer(this, user, channel, tmpl, message), channelName);
|
||||
@ -2735,7 +2794,7 @@ public final class PurpleBot {
|
||||
*/
|
||||
if (isMessageEnabled(channelName, TemplateName.IRC_CHAT) || override) {
|
||||
String newMessage = filterMessage(
|
||||
plugin.tokenizer.ircChatToGameTokenizer(this, user, channel, plugin.getMsgTemplate(
|
||||
plugin.tokenizer.ircChatToGameTokenizer(this, user, channel, plugin.getMessageTemplate(
|
||||
botNick, channelName, TemplateName.IRC_CHAT), message), channelName);
|
||||
if (!newMessage.isEmpty()) {
|
||||
plugin.broadcastToGame(newMessage, "irc.message.chat");
|
||||
@ -2747,10 +2806,10 @@ public final class PurpleBot {
|
||||
Send messages to console if enabled
|
||||
*/
|
||||
if (isMessageEnabled(channelName, TemplateName.IRC_CONSOLE_CHAT)) {
|
||||
String tmpl = plugin.getMsgTemplate(botNick, channelName, TemplateName.IRC_CONSOLE_CHAT);
|
||||
String tmpl = plugin.getMessageTemplate(botNick, channelName, TemplateName.IRC_CONSOLE_CHAT);
|
||||
plugin.logDebug("broadcastChat [Console]: " + tmpl);
|
||||
plugin.getServer().getConsoleSender().sendMessage(plugin.tokenizer.ircChatToGameTokenizer(
|
||||
this, user, channel, plugin.getMsgTemplate(botNick, channelName, TemplateName.IRC_CONSOLE_CHAT), message));
|
||||
this, user, channel, plugin.getMessageTemplate(botNick, channelName, TemplateName.IRC_CONSOLE_CHAT), message));
|
||||
messageSent = true;
|
||||
}
|
||||
|
||||
@ -2759,7 +2818,7 @@ public final class PurpleBot {
|
||||
*/
|
||||
if (isMessageEnabled(channelName, TemplateName.IRC_HERO_CHAT)) {
|
||||
String hChannel = heroChannel.get(channelName);
|
||||
String tmpl = plugin.getIRCHeroChatChannelTemplate(botNick, hChannel);
|
||||
String tmpl = plugin.getIrcHeroChatTemplate(botNick, hChannel);
|
||||
plugin.logDebug("broadcastChat [HC]: " + hChannel + ": " + tmpl);
|
||||
String rawHCMessage = filterMessage(
|
||||
plugin.tokenizer.ircChatToHeroChatTokenizer(this, user, channel, tmpl, message, Herochat.getChannelManager(), hChannel), channelName);
|
||||
@ -2774,13 +2833,33 @@ public final class PurpleBot {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Send messages to MineverseChat if enabled
|
||||
*/
|
||||
if (isMessageEnabled(channelName, TemplateName.IRC_MINEVERSE_CHAT) && plugin.mineverseChatEnabled) {
|
||||
String mvChannel = mineverseChannel.get(channelName);
|
||||
String mvTemplate = plugin.getIrcMineverseChatTemplate(botNick, mvChannel);
|
||||
plugin.logDebug("broadcastChat [MV]: " + mvChannel + ": " + mvTemplate);
|
||||
String rawMvMessage = filterMessage(
|
||||
plugin.tokenizer.ircChatToMineverseChatTokenizer(this, user, channel, mvTemplate, message, mvChannel), channelName);
|
||||
if (!rawMvMessage.isEmpty()) {
|
||||
plugin.mvHook.sendMessage(mvChannel, rawMvMessage);
|
||||
messageSent = true;
|
||||
if (logIrcToMineverseChat.containsKey(channelName)) {
|
||||
if (logIrcToMineverseChat.get(channelName)) {
|
||||
plugin.getServer().getConsoleSender().sendMessage(rawMvMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Send messages to Essentials if enabled
|
||||
*/
|
||||
if (plugin.isPluginEnabled("Essentials")) {
|
||||
if (isMessageEnabled(channelName, TemplateName.IRC_ESS_HELPOP) || override) {
|
||||
String newMessage = filterMessage(
|
||||
plugin.tokenizer.ircChatToGameTokenizer(this, user, channel, plugin.getMsgTemplate(
|
||||
plugin.tokenizer.ircChatToGameTokenizer(this, user, channel, plugin.getMessageTemplate(
|
||||
botNick, channelName, TemplateName.IRC_ESS_HELPOP), message), channelName);
|
||||
if (!newMessage.isEmpty()) {
|
||||
plugin.broadcastToGame(newMessage, "essentials.helpop.receive");
|
||||
@ -2795,7 +2874,7 @@ public final class PurpleBot {
|
||||
if (plugin.adminPrivateChatHook != null) {
|
||||
if (isMessageEnabled(channelName, TemplateName.IRC_ADMIN_CHAT) || override) {
|
||||
String newMessage = filterMessage(
|
||||
plugin.tokenizer.ircChatToGameTokenizer(this, user, channel, plugin.getMsgTemplate(botNick, channelName, TemplateName.IRC_ADMIN_CHAT), message), channelName);
|
||||
plugin.tokenizer.ircChatToGameTokenizer(this, user, channel, plugin.getMessageTemplate(botNick, channelName, TemplateName.IRC_ADMIN_CHAT), message), channelName);
|
||||
if (!newMessage.isEmpty()) {
|
||||
plugin.adminPrivateChatHook.sendMessage(newMessage, user.getNick());
|
||||
messageSent = true;
|
||||
@ -2808,7 +2887,7 @@ public final class PurpleBot {
|
||||
*/
|
||||
if (isMessageEnabled(channelName, TemplateName.IRC_CHAT_RESPONSE) && messageSent && target != null) {
|
||||
// Let the sender know the message was sent
|
||||
String responseTemplate = plugin.getMsgTemplate(botNick, channelName, TemplateName.IRC_CHAT_RESPONSE);
|
||||
String responseTemplate = plugin.getMessageTemplate(botNick, channelName, TemplateName.IRC_CHAT_RESPONSE);
|
||||
if (!responseTemplate.isEmpty()) {
|
||||
if (ctcpResponse) {
|
||||
asyncCTCPMessage(target, plugin.tokenizer.targetChatResponseTokenizer(target, message, responseTemplate));
|
||||
@ -2820,8 +2899,8 @@ public final class PurpleBot {
|
||||
|
||||
}
|
||||
|
||||
// Broadcast chat messages from IRC to specific hero channel
|
||||
/**
|
||||
* Broadcast chat messages from IRC to specific hero channel
|
||||
*
|
||||
* @param user
|
||||
* @param channel
|
||||
@ -2844,7 +2923,7 @@ public final class PurpleBot {
|
||||
plugin.logDebug("Checking if " + hChannel + " is a valid hero channel...");
|
||||
if (Herochat.getChannelManager().hasChannel(hChannel)) {
|
||||
hChannel = Herochat.getChannelManager().getChannel(hChannel).getName();
|
||||
String template = plugin.getIRCHeroChatChannelTemplate(botNick, hChannel);
|
||||
String template = plugin.getIrcHeroChatTemplate(botNick, hChannel);
|
||||
plugin.logDebug("T: " + template);
|
||||
String t = plugin.tokenizer.ircChatToHeroChatTokenizer(this, user,
|
||||
channel, template, msg,
|
||||
@ -2854,7 +2933,7 @@ public final class PurpleBot {
|
||||
.sendRawMessage(t);
|
||||
plugin.logDebug("Channel format: " + Herochat.getChannelManager().getChannel(hChannel).getFormat());
|
||||
// Let the sender know the message was sent
|
||||
String responseTemplate = plugin.getMsgTemplate(botNick, channelName, TemplateName.IRC_HCHAT_RESPONSE);
|
||||
String responseTemplate = plugin.getMessageTemplate(botNick, channelName, TemplateName.IRC_HCHAT_RESPONSE);
|
||||
if (!responseTemplate.isEmpty()) {
|
||||
asyncIRCMessage(target, plugin.tokenizer
|
||||
.targetChatResponseTokenizer(hChannel, msg, responseTemplate));
|
||||
@ -2915,10 +2994,10 @@ public final class PurpleBot {
|
||||
if (player != null) {
|
||||
if (player.isOnline()) {
|
||||
plugin.logDebug("Yup, " + pName + " is a valid player...");
|
||||
String template = plugin.getMsgTemplate(botNick, channelName, TemplateName.IRC_PCHAT);
|
||||
String template = plugin.getMessageTemplate(botNick, channelName, TemplateName.IRC_PCHAT);
|
||||
String t = plugin.tokenizer.ircChatToGameTokenizer(this, user,
|
||||
channel, template, msg);
|
||||
String responseTemplate = plugin.getMsgTemplate(
|
||||
String responseTemplate = plugin.getMessageTemplate(
|
||||
botNick, channelName, TemplateName.IRC_PCHAT_RESPONSE);
|
||||
if (!responseTemplate.isEmpty()) {
|
||||
asyncIRCMessage(target, plugin.tokenizer
|
||||
@ -2959,7 +3038,7 @@ public final class PurpleBot {
|
||||
if (player != null) {
|
||||
if (player.isOnline()) {
|
||||
plugin.logDebug("Yup, " + pName + " is a valid player...");
|
||||
String template = plugin.getMsgTemplate(botNick, "", TemplateName.CROSS_CHAT);
|
||||
String template = plugin.getMessageTemplate(botNick, "", TemplateName.CROSS_CHAT);
|
||||
String m = template.replace("%MESSAGE%", msg).replace("%SERVER%", user.getNick());
|
||||
player.sendMessage(plugin.colorConverter.ircColorsToGame(m));
|
||||
plugin.privateMsgReply.put(pName, from);
|
||||
@ -2983,7 +3062,7 @@ public final class PurpleBot {
|
||||
String channelName = channel.getName();
|
||||
if (isMessageEnabled(channelName, TemplateName.IRC_ACTION)) {
|
||||
plugin.broadcastToGame(plugin.tokenizer.ircChatToGameTokenizer(
|
||||
this, user, channel, plugin.getMsgTemplate(
|
||||
this, user, channel, plugin.getMessageTemplate(
|
||||
botNick, channelName, TemplateName.IRC_ACTION), message), "irc.message.action");
|
||||
} else {
|
||||
plugin.logDebug("Ignoring action due to "
|
||||
@ -2992,7 +3071,7 @@ public final class PurpleBot {
|
||||
|
||||
if (isMessageEnabled(channelName, TemplateName.IRC_HERO_ACTION)) {
|
||||
String hChannel = heroChannel.get(channelName);
|
||||
String tmpl = plugin.getIRCHeroActionChannelTemplate(botNick, hChannel);
|
||||
String tmpl = plugin.getIrcHeroActionTemplate(botNick, hChannel);
|
||||
plugin.logDebug("broadcastChat [HA]: " + hChannel + ": " + tmpl);
|
||||
String rawHCMessage = filterMessage(
|
||||
plugin.tokenizer.ircChatToHeroChatTokenizer(this, user, channel, tmpl, message, Herochat.getChannelManager(), hChannel), channelName);
|
||||
@ -3008,7 +3087,7 @@ public final class PurpleBot {
|
||||
|
||||
if (plugin.dynmapHook != null) {
|
||||
if (isMessageEnabled(channelName, TemplateName.IRC_ACTION_DYNMAP_WEB_CHAT)) {
|
||||
String template = plugin.getMsgTemplate(botNick, channelName, TemplateName.IRC_ACTION_DYNMAP_WEB_CHAT);
|
||||
String template = plugin.getMessageTemplate(botNick, channelName, TemplateName.IRC_ACTION_DYNMAP_WEB_CHAT);
|
||||
String rawDWMessage = filterMessage(
|
||||
plugin.tokenizer.ircChatToGameTokenizer(this, user, channel, template, message), channelName);
|
||||
plugin.dynmapHook.sendMessage(user.getNick(), rawDWMessage);
|
||||
@ -3027,7 +3106,7 @@ public final class PurpleBot {
|
||||
String channelName = channel.getName();
|
||||
if (isMessageEnabled(channelName, TemplateName.IRC_KICK)) {
|
||||
plugin.broadcastToGame(plugin.tokenizer.ircKickTokenizer(
|
||||
this, recipient, kicker, reason, channel, plugin.getMsgTemplate(
|
||||
this, recipient, kicker, reason, channel, plugin.getMessageTemplate(
|
||||
botNick, channelName, TemplateName.IRC_KICK)),
|
||||
"irc.message.kick");
|
||||
}
|
||||
@ -3038,7 +3117,7 @@ public final class PurpleBot {
|
||||
.ircKickToHeroChatTokenizer(this,
|
||||
recipient, kicker,
|
||||
reason, channel,
|
||||
plugin.getMsgTemplate(botNick, channelName, TemplateName.IRC_HERO_KICK),
|
||||
plugin.getMessageTemplate(botNick, channelName, TemplateName.IRC_HERO_KICK),
|
||||
Herochat.getChannelManager(),
|
||||
heroChannel.get(channelName)
|
||||
)
|
||||
@ -3064,7 +3143,7 @@ public final class PurpleBot {
|
||||
String channelName = channel.getName();
|
||||
if (isMessageEnabled(channel, TemplateName.IRC_MODE)) {
|
||||
plugin.broadcastToGame(plugin.tokenizer.ircModeTokenizer(this, user, mode,
|
||||
channel, plugin.getMsgTemplate(
|
||||
channel, plugin.getMessageTemplate(
|
||||
botNick, channelName, TemplateName.IRC_MODE)), "irc.message.mode");
|
||||
}
|
||||
}
|
||||
@ -3080,7 +3159,7 @@ public final class PurpleBot {
|
||||
String channelName = channel.getName();
|
||||
if (isMessageEnabled(channel, TemplateName.IRC_NOTICE)) {
|
||||
plugin.broadcastToGame(plugin.tokenizer.ircNoticeTokenizer(this, user,
|
||||
message, notice, channel, plugin.getMsgTemplate(
|
||||
message, notice, channel, plugin.getMessageTemplate(
|
||||
botNick, channelName, TemplateName.IRC_NOTICE)), "irc.message.notice");
|
||||
}
|
||||
}
|
||||
@ -3095,7 +3174,7 @@ public final class PurpleBot {
|
||||
if (isMessageEnabled(channel, TemplateName.IRC_JOIN)) {
|
||||
plugin.logDebug("[broadcastIRCJoin] Broadcasting join message because " + TemplateName.IRC_JOIN + " is true.");
|
||||
plugin.broadcastToGame(plugin.tokenizer.chatIRCTokenizer(
|
||||
this, user, channel, plugin.getMsgTemplate(botNick, channelName, TemplateName.IRC_JOIN)), "irc.message.join");
|
||||
this, user, channel, plugin.getMessageTemplate(botNick, channelName, TemplateName.IRC_JOIN)), "irc.message.join");
|
||||
} else {
|
||||
plugin.logDebug("[broadcastIRCJoin] NOT broadcasting join message because irc-join is false.");
|
||||
}
|
||||
@ -3103,7 +3182,7 @@ public final class PurpleBot {
|
||||
if (isMessageEnabled(channel, TemplateName.IRC_HERO_JOIN)) {
|
||||
Herochat.getChannelManager().getChannel(heroChannel.get(channel.getName()))
|
||||
.sendRawMessage(plugin.tokenizer.ircChatToHeroChatTokenizer(
|
||||
this, user, channel, plugin.getMsgTemplate(
|
||||
this, user, channel, plugin.getMessageTemplate(
|
||||
botNick, channelName, TemplateName.IRC_HERO_JOIN),
|
||||
Herochat.getChannelManager(),
|
||||
heroChannel.get(channel.getName())));
|
||||
@ -3114,7 +3193,7 @@ public final class PurpleBot {
|
||||
String channelName = channel.getName();
|
||||
if (isMessageEnabled(channel, TemplateName.IRC_PART)) {
|
||||
String message = plugin.tokenizer.chatIRCTokenizer(
|
||||
this, user, channel, plugin.getMsgTemplate(botNick, channelName, TemplateName.IRC_PART));
|
||||
this, user, channel, plugin.getMessageTemplate(botNick, channelName, TemplateName.IRC_PART));
|
||||
plugin.logDebug("[broadcastIRCPart] Broadcasting part message because "
|
||||
+ TemplateName.IRC_PART + " is true: " + message);
|
||||
plugin.broadcastToGame(message, "irc.message.part");
|
||||
@ -3126,7 +3205,7 @@ public final class PurpleBot {
|
||||
if (isMessageEnabled(channel, TemplateName.IRC_HERO_PART)) {
|
||||
Herochat.getChannelManager().getChannel(heroChannel.get(channel.getName()))
|
||||
.sendRawMessage(plugin.tokenizer.ircChatToHeroChatTokenizer(
|
||||
this, user, channel, plugin.getMsgTemplate(
|
||||
this, user, channel, plugin.getMessageTemplate(
|
||||
botNick, channelName, TemplateName.IRC_HERO_PART),
|
||||
Herochat.getChannelManager(),
|
||||
heroChannel.get(channel.getName())));
|
||||
@ -3139,7 +3218,7 @@ public final class PurpleBot {
|
||||
plugin.logDebug("[broadcastIRCQuit] Broadcasting quit message because "
|
||||
+ TemplateName.IRC_QUIT + " is true.");
|
||||
plugin.broadcastToGame(plugin.tokenizer.chatIRCTokenizer(
|
||||
this, user, channel, plugin.getMsgTemplate(botNick, channelName, TemplateName.IRC_QUIT))
|
||||
this, user, channel, plugin.getMessageTemplate(botNick, channelName, TemplateName.IRC_QUIT))
|
||||
.replace("%REASON%", reason), "irc.message.quit");
|
||||
} else {
|
||||
plugin.logDebug("[broadcastIRCQuit] NOT broadcasting quit message because "
|
||||
@ -3149,7 +3228,7 @@ public final class PurpleBot {
|
||||
if (isMessageEnabled(channel, TemplateName.IRC_HERO_QUIT)) {
|
||||
Herochat.getChannelManager().getChannel(heroChannel.get(channel.getName()))
|
||||
.sendRawMessage(plugin.tokenizer.ircChatToHeroChatTokenizer(
|
||||
this, user, channel, plugin.getMsgTemplate(
|
||||
this, user, channel, plugin.getMessageTemplate(
|
||||
botNick, channelName, TemplateName.IRC_HERO_QUIT),
|
||||
Herochat.getChannelManager(),
|
||||
heroChannel.get(channel.getName())));
|
||||
@ -3168,13 +3247,13 @@ public final class PurpleBot {
|
||||
String channelName = channel.getName();
|
||||
if (isMessageEnabled(channel, TemplateName.IRC_TOPIC)) {
|
||||
plugin.broadcastToGame(plugin.tokenizer.chatIRCTokenizer(
|
||||
this, user, channel, plugin.getMsgTemplate(botNick, channelName, TemplateName.IRC_TOPIC)), "irc.message.topic");
|
||||
this, user, channel, plugin.getMessageTemplate(botNick, channelName, TemplateName.IRC_TOPIC)), "irc.message.topic");
|
||||
}
|
||||
|
||||
if (isMessageEnabled(channel, TemplateName.IRC_HERO_TOPIC)) {
|
||||
Herochat.getChannelManager().getChannel(heroChannel.get(channel.getName()))
|
||||
.sendRawMessage(plugin.tokenizer.ircChatToHeroChatTokenizer(
|
||||
this, user, channel, plugin.getMsgTemplate(botNick, channelName, TemplateName.IRC_HERO_TOPIC), message,
|
||||
this, user, channel, plugin.getMessageTemplate(botNick, channelName, TemplateName.IRC_HERO_TOPIC), message,
|
||||
Herochat.getChannelManager(),
|
||||
heroChannel.get(channel.getName())));
|
||||
}
|
||||
@ -3246,12 +3325,12 @@ public final class PurpleBot {
|
||||
if (channelCmdNotifyMode.equalsIgnoreCase("msg")) {
|
||||
for (String recipient : channelCmdNotifyRecipients) {
|
||||
asyncIRCMessage(recipient, plugin.tokenizer.gameCommandToIRCTokenizer(player, plugin
|
||||
.getMsgTemplate(botNick, recipient, TemplateName.GAME_COMMAND), cmd, params));
|
||||
.getMessageTemplate(botNick, recipient, TemplateName.GAME_COMMAND), cmd, params));
|
||||
}
|
||||
} else if (channelCmdNotifyMode.equalsIgnoreCase("ctcp")) {
|
||||
for (String recipient : channelCmdNotifyRecipients) {
|
||||
asyncCTCPMessage(recipient, plugin.tokenizer.gameCommandToIRCTokenizer(player, plugin
|
||||
.getMsgTemplate(botNick, recipient, TemplateName.GAME_COMMAND), cmd, params));
|
||||
.getMessageTemplate(botNick, recipient, TemplateName.GAME_COMMAND), cmd, params));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3270,9 +3349,9 @@ public final class PurpleBot {
|
||||
if (isMessageEnabled(channelName, TemplateName.GAME_AFK) && isPlayerInValidWorld(player, channelName)) {
|
||||
String template;
|
||||
if (afk) {
|
||||
template = plugin.getMsgTemplate(botNick, channelName, TemplateName.ESS_PLAYER_AFK);
|
||||
template = plugin.getMessageTemplate(botNick, channelName, TemplateName.ESS_PLAYER_AFK);
|
||||
} else {
|
||||
template = plugin.getMsgTemplate(botNick, channelName, TemplateName.ESS_PLAYER_NOT_AFK);
|
||||
template = plugin.getMessageTemplate(botNick, channelName, TemplateName.ESS_PLAYER_NOT_AFK);
|
||||
}
|
||||
plugin.logDebug("Sending AFK message to " + channelName);
|
||||
asyncIRCMessage(channelName, plugin.tokenizer.gamePlayerAFKTokenizer(player, template));
|
||||
@ -3289,7 +3368,7 @@ public final class PurpleBot {
|
||||
*/
|
||||
public void msgPlayer(Player sender, String nick, String message) {
|
||||
String msg = plugin.tokenizer.gameChatToIRCTokenizer(sender,
|
||||
plugin.getMsgTemplate(botNick, "", TemplateName.GAME_PCHAT), message);
|
||||
plugin.getMessageTemplate(botNick, "", TemplateName.GAME_PCHAT), message);
|
||||
asyncIRCMessage(nick, msg);
|
||||
ircPrivateMsgMap.put(sender.getName(), nick);
|
||||
if (logPrivateChat) {
|
||||
@ -3307,7 +3386,7 @@ public final class PurpleBot {
|
||||
*/
|
||||
public void msgRemotePlayer(Player sender, String remoteBot, String remotePlayer, String message) {
|
||||
String msg = plugin.tokenizer.gameChatToIRCTokenizer(sender,
|
||||
plugin.getMsgTemplate(botNick, "", TemplateName.GAME_PCHAT), message);
|
||||
plugin.getMessageTemplate(botNick, "", TemplateName.GAME_PCHAT), message);
|
||||
if (botLinks.containsKey(remoteBot)) {
|
||||
String code = botLinks.get(remoteBot);
|
||||
String from = sender.getName();
|
||||
@ -3365,7 +3444,7 @@ public final class PurpleBot {
|
||||
*/
|
||||
public void consoleMsgPlayer(String nick, String message) {
|
||||
String msg = plugin.tokenizer.gameChatToIRCTokenizer("console",
|
||||
plugin.getMsgTemplate(botNick, "", TemplateName.CONSOLE_CHAT), message);
|
||||
plugin.getMessageTemplate(botNick, "", TemplateName.CONSOLE_CHAT), message);
|
||||
asyncIRCMessage(nick, msg);
|
||||
}
|
||||
|
||||
@ -3379,7 +3458,7 @@ public final class PurpleBot {
|
||||
*/
|
||||
public void msgRemotePlayer(CommandSender sender, String remoteBot, String remotePlayer, String message) {
|
||||
String msg = plugin.tokenizer.gameChatToIRCTokenizer(sender.getName(),
|
||||
plugin.getMsgTemplate(botNick, "", TemplateName.CONSOLE_CHAT), message);
|
||||
plugin.getMessageTemplate(botNick, "", TemplateName.CONSOLE_CHAT), message);
|
||||
if (botLinks.containsKey(remoteBot)) {
|
||||
String code = botLinks.get(remoteBot);
|
||||
String from = sender.getName();
|
||||
@ -3537,7 +3616,7 @@ public final class PurpleBot {
|
||||
for (String channelName : botChannels) {
|
||||
if (isMessageEnabled(channelName, TemplateName.PRISM_ROLLBACK)) {
|
||||
asyncIRCMessage(channelName, prismBlockStateChangeTokens(plugin.tokenizer
|
||||
.playerTokenizer(player, plugin.getMsgTemplate(botNick, channelName, TemplateName.PRISM_ROLLBACK))
|
||||
.playerTokenizer(player, plugin.getMessageTemplate(botNick, channelName, TemplateName.PRISM_ROLLBACK))
|
||||
.replace("%COMMAND%", queryParams.getOriginalCommand())
|
||||
.replace("%KEYWORD%", keyword)
|
||||
.replace("%SORTDIRECTION%", sortDirection)
|
||||
@ -3561,7 +3640,7 @@ public final class PurpleBot {
|
||||
for (String channelName : botChannels) {
|
||||
if (isMessageEnabled(channelName, template)) {
|
||||
asyncIRCMessage(channelName, prismBlockStateChangeTokens(plugin.tokenizer
|
||||
.playerTokenizer(player, plugin.getMsgTemplate(botNick, channelName, template))
|
||||
.playerTokenizer(player, plugin.getMessageTemplate(botNick, channelName, template))
|
||||
.replace("%RADIUS%", radiusStr), blockStateChange
|
||||
));
|
||||
}
|
||||
@ -3575,7 +3654,7 @@ public final class PurpleBot {
|
||||
for (String channelName : botChannels) {
|
||||
if (isMessageEnabled(channelName, TemplateName.PRISM_CUSTOM)) {
|
||||
asyncIRCMessage(channelName, plugin.tokenizer
|
||||
.playerTokenizer(player, plugin.getMsgTemplate(botNick, channelName, TemplateName.PRISM_CUSTOM))
|
||||
.playerTokenizer(player, plugin.getMessageTemplate(botNick, channelName, TemplateName.PRISM_CUSTOM))
|
||||
.replace("%ACTION%", actionName)
|
||||
.replace("%MESSAGE%", message)
|
||||
.replace("%PLUGIN%", pluginName)
|
||||
|
@ -48,6 +48,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.MineverseChatHook;
|
||||
import com.cnaude.purpleirc.Hooks.ReportRTSHook;
|
||||
import com.cnaude.purpleirc.Hooks.ShortifyHook;
|
||||
import com.cnaude.purpleirc.Hooks.SuperVanishHook;
|
||||
@ -119,9 +120,13 @@ public class PurpleIRC extends JavaPlugin {
|
||||
private final CaseInsensitiveMap<HashMap<String, String>> messageTmpl;
|
||||
private final CaseInsensitiveMap<CaseInsensitiveMap<String>> ircHeroChannelMessages;
|
||||
private final CaseInsensitiveMap<CaseInsensitiveMap<String>> ircHeroActionChannelMessages;
|
||||
private final CaseInsensitiveMap<CaseInsensitiveMap<String>> ircMineverseChannelMessages;
|
||||
private final CaseInsensitiveMap<CaseInsensitiveMap<String>> ircMineverseActionChannelMessages;
|
||||
private final CaseInsensitiveMap<CaseInsensitiveMap<String>> ircTownyChannelMessages;
|
||||
private final CaseInsensitiveMap<CaseInsensitiveMap<String>> heroChannelMessages;
|
||||
private final CaseInsensitiveMap<CaseInsensitiveMap<String>> heroActionChannelMessages;
|
||||
private final CaseInsensitiveMap<CaseInsensitiveMap<String>> mineverseChannelMessages;
|
||||
private final CaseInsensitiveMap<CaseInsensitiveMap<String>> mineverseActionChannelMessages;
|
||||
private final Map<String, String> hostCache;
|
||||
public String defaultPlayerSuffix,
|
||||
defaultPlayerPrefix,
|
||||
@ -168,6 +173,7 @@ public class PurpleIRC extends JavaPlugin {
|
||||
private boolean listSortByName;
|
||||
public boolean exactNickMatch;
|
||||
public boolean ignoreChatCancel;
|
||||
public boolean mineverseChatEnabled;
|
||||
public Long ircConnCheckInterval;
|
||||
public Long ircChannelCheckInterval;
|
||||
public ChannelWatcher channelWatcher;
|
||||
@ -177,6 +183,7 @@ public class PurpleIRC extends JavaPlugin {
|
||||
public CaseInsensitiveMap<PurpleBot> ircBots;
|
||||
public FactionChatHook fcHook;
|
||||
public TownyChatHook tcHook;
|
||||
public MineverseChatHook mvHook;
|
||||
public DynmapHook dynmapHook;
|
||||
public JobsHook jobsHook;
|
||||
public AdminPrivateChatHook adminPrivateChatHook;
|
||||
@ -222,6 +229,7 @@ public class PurpleIRC extends JavaPlugin {
|
||||
final String PL_REDDITSTREAM = "RedditStream";
|
||||
final String PL_PRISM = "Prism";
|
||||
final String PL_TITANCHAT = "TitanChat";
|
||||
final String PL_MINEVERSECHAT = "MineverseChat";
|
||||
final String PL_HEROCHAT = "Herochat";
|
||||
final String PL_GRIEFPREVENTION = "GriefPrevention";
|
||||
List<String> hookList = new ArrayList<>();
|
||||
@ -241,9 +249,13 @@ public class PurpleIRC extends JavaPlugin {
|
||||
this.messageTmpl = new CaseInsensitiveMap<>();
|
||||
this.ircHeroChannelMessages = new CaseInsensitiveMap<>();
|
||||
this.ircHeroActionChannelMessages = new CaseInsensitiveMap<>();
|
||||
this.ircMineverseChannelMessages = new CaseInsensitiveMap<>();
|
||||
this.ircMineverseActionChannelMessages = new CaseInsensitiveMap<>();
|
||||
this.ircTownyChannelMessages = new CaseInsensitiveMap<>();
|
||||
this.heroChannelMessages = new CaseInsensitiveMap<>();
|
||||
this.heroActionChannelMessages = new CaseInsensitiveMap<>();
|
||||
this.mineverseChannelMessages = new CaseInsensitiveMap<>();
|
||||
this.mineverseActionChannelMessages = new CaseInsensitiveMap<>();
|
||||
this.displayNameCache = new CaseInsensitiveMap<>();
|
||||
this.uuidCache = new CaseInsensitiveMap<>();
|
||||
this.hostCache = new HashMap<>();
|
||||
@ -405,93 +417,100 @@ public class PurpleIRC extends JavaPlugin {
|
||||
*
|
||||
* @param botName
|
||||
* @param channelName
|
||||
* @param tmpl
|
||||
* @param template
|
||||
* @return
|
||||
*/
|
||||
public String getMsgTemplate(String botName, String channelName, String tmpl) {
|
||||
public String getMessageTemplate(String botName, String channelName, String template) {
|
||||
if (messageTmpl.containsKey(botName + "." + channelName)) {
|
||||
if (messageTmpl.get(botName + "." + channelName).containsKey(tmpl)) {
|
||||
return messageTmpl.get(botName + "." + channelName).get(tmpl);
|
||||
if (messageTmpl.get(botName + "." + channelName).containsKey(template)) {
|
||||
return messageTmpl.get(botName + "." + channelName).get(template);
|
||||
}
|
||||
}
|
||||
if (messageTmpl.containsKey(botName)) {
|
||||
if (messageTmpl.get(botName).containsKey(tmpl)) {
|
||||
return messageTmpl.get(botName).get(tmpl);
|
||||
if (messageTmpl.get(botName).containsKey(template)) {
|
||||
return messageTmpl.get(botName).get(template);
|
||||
}
|
||||
}
|
||||
if (messageTmpl.get(MAINCONFIG).containsKey(tmpl)) {
|
||||
return messageTmpl.get(MAINCONFIG).get(tmpl);
|
||||
}
|
||||
return "INVALID TEMPLATE: " + botName + ":" + tmpl;
|
||||
}
|
||||
|
||||
public String getMsgTemplate(String tmpl) {
|
||||
return getMsgTemplate(MAINCONFIG, "", tmpl);
|
||||
}
|
||||
|
||||
public String getHeroTemplate(CaseInsensitiveMap<CaseInsensitiveMap<String>> hc,
|
||||
String botName, String hChannel) {
|
||||
if (hc.containsKey(botName)) {
|
||||
logDebug("HC1 => " + hChannel);
|
||||
for (String s : hc.get(botName).keySet()) {
|
||||
logDebug("HT => " + s);
|
||||
}
|
||||
if (hc.get(botName).containsKey(hChannel)) {
|
||||
logDebug("HC2 => " + hChannel);
|
||||
return hc.get(botName).get(hChannel);
|
||||
}
|
||||
}
|
||||
if (hc.containsKey(MAINCONFIG)) {
|
||||
logDebug("HC3 => " + hChannel);
|
||||
for (String s : hc.get(MAINCONFIG).keySet()) {
|
||||
logDebug("HT => " + s);
|
||||
}
|
||||
if (hc.get(MAINCONFIG).containsKey(hChannel)) {
|
||||
logDebug("HC4 => " + hChannel);
|
||||
return hc.get(MAINCONFIG).get(hChannel);
|
||||
}
|
||||
if (messageTmpl.get(MAINCONFIG).containsKey(template)) {
|
||||
return messageTmpl.get(MAINCONFIG).get(template);
|
||||
}
|
||||
logDebug("No such template: " + template);
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getHeroChatChannelTemplate(String botName, String hChannel) {
|
||||
String tmpl = getHeroTemplate(heroChannelMessages, botName, hChannel);
|
||||
if (tmpl.isEmpty()) {
|
||||
return getMsgTemplate(MAINCONFIG, "", TemplateName.HERO_CHAT);
|
||||
}
|
||||
return getHeroTemplate(heroChannelMessages, botName, hChannel);
|
||||
public String getMessageTemplate(String template) {
|
||||
return getMessageTemplate(MAINCONFIG, "", template);
|
||||
}
|
||||
|
||||
public String getHeroActionChannelTemplate(String botName, String hChannel) {
|
||||
String tmpl = getHeroTemplate(heroActionChannelMessages, botName, hChannel);
|
||||
if (tmpl.isEmpty()) {
|
||||
return getMsgTemplate(MAINCONFIG, "", TemplateName.HERO_ACTION);
|
||||
/**
|
||||
* Get message template for HeroChat, MineverseChat or TownyChat based on
|
||||
* channel name
|
||||
*
|
||||
* @param templateMap map of message templates for specific chat plugin
|
||||
* @param botName our bot name
|
||||
* @param channel channel for plugin
|
||||
* @param template default template to look for if other is not found
|
||||
* @return message template
|
||||
*/
|
||||
private String getMessageTemplate(CaseInsensitiveMap<CaseInsensitiveMap<String>> templateMap,
|
||||
String botName, String channel, String template) {
|
||||
if (templateMap.containsKey(botName)) {
|
||||
logDebug("HC1 => " + channel);
|
||||
for (String s : templateMap.get(botName).keySet()) {
|
||||
logDebug("HT => " + s);
|
||||
}
|
||||
if (templateMap.get(botName).containsKey(channel)) {
|
||||
logDebug("HC2 => " + channel);
|
||||
return templateMap.get(botName).get(channel);
|
||||
}
|
||||
}
|
||||
return getHeroTemplate(heroActionChannelMessages, botName, hChannel);
|
||||
if (templateMap.containsKey(MAINCONFIG)) {
|
||||
logDebug("HC3 => " + channel);
|
||||
for (String s : templateMap.get(MAINCONFIG).keySet()) {
|
||||
logDebug("HT => " + s);
|
||||
}
|
||||
if (templateMap.get(MAINCONFIG).containsKey(channel)) {
|
||||
logDebug("HC4 => " + channel);
|
||||
return templateMap.get(MAINCONFIG).get(channel);
|
||||
}
|
||||
}
|
||||
return getMessageTemplate(MAINCONFIG, "", template);
|
||||
}
|
||||
|
||||
public String getIRCHeroChatChannelTemplate(String botName, String hChannel) {
|
||||
String tmpl = getHeroTemplate(ircHeroChannelMessages, botName, hChannel);
|
||||
if (tmpl.isEmpty()) {
|
||||
return getMsgTemplate(MAINCONFIG, "", TemplateName.IRC_HERO_CHAT);
|
||||
}
|
||||
return getHeroTemplate(ircHeroChannelMessages, botName, hChannel);
|
||||
public String getHeroChatTemplate(String botName, String channel) {
|
||||
return getMessageTemplate(heroChannelMessages, botName, channel, TemplateName.HERO_CHAT);
|
||||
}
|
||||
|
||||
public String getIRCHeroActionChannelTemplate(String botName, String hChannel) {
|
||||
String tmpl = getHeroTemplate(ircHeroActionChannelMessages, botName, hChannel);
|
||||
if (tmpl.isEmpty()) {
|
||||
return getMsgTemplate(MAINCONFIG, "", TemplateName.IRC_HERO_ACTION);
|
||||
}
|
||||
return getHeroTemplate(ircHeroActionChannelMessages, botName, hChannel);
|
||||
public String getHeroActionTemplate(String botName, String channel) {
|
||||
return getMessageTemplate(heroActionChannelMessages, botName, channel, TemplateName.HERO_ACTION);
|
||||
}
|
||||
|
||||
public String getIRCTownyChatChannelTemplate(String botName, String tChannel) {
|
||||
String tmpl = getHeroTemplate(ircTownyChannelMessages, botName, tChannel);
|
||||
if (tmpl.isEmpty()) {
|
||||
return getMsgTemplate(MAINCONFIG, "", TemplateName.IRC_TOWNY_CHAT);
|
||||
}
|
||||
return getHeroTemplate(ircTownyChannelMessages, botName, tChannel);
|
||||
public String getIrcHeroChatTemplate(String botName, String channel) {
|
||||
return getMessageTemplate(ircHeroChannelMessages, botName, channel, TemplateName.IRC_HERO_CHAT);
|
||||
}
|
||||
|
||||
public String getIrcHeroActionTemplate(String botName, String channel) {
|
||||
return getMessageTemplate(ircHeroActionChannelMessages, botName, channel, TemplateName.IRC_HERO_ACTION);
|
||||
}
|
||||
|
||||
public String getMineverseChatTemplate(String botName, String channel) {
|
||||
return getMessageTemplate(mineverseChannelMessages, botName, channel, TemplateName.MINEVERSE_CHAT);
|
||||
}
|
||||
|
||||
public String getMineverseActionTemplate(String botName, String channel) {
|
||||
return getMessageTemplate(mineverseActionChannelMessages, botName, channel, TemplateName.MINEVERSE_ACTION);
|
||||
}
|
||||
|
||||
public String getIrcMineverseChatTemplate(String botName, String channel) {
|
||||
return getMessageTemplate(ircMineverseChannelMessages, botName, channel, TemplateName.IRC_MINEVERSE_CHAT);
|
||||
}
|
||||
|
||||
public String getIrcMineverseActionTemplate(String botName, String channel) {
|
||||
return getMessageTemplate(ircMineverseActionChannelMessages, botName, channel, TemplateName.IRC_MINEVERSE_ACTION);
|
||||
}
|
||||
|
||||
public String getIrcTownyChatTemplate(String botName, String channel) {
|
||||
return getMessageTemplate(ircTownyChannelMessages, botName, channel, TemplateName.IRC_TOWNY_CHAT);
|
||||
}
|
||||
|
||||
public void loadCustomColors(YamlConfiguration config) {
|
||||
@ -505,12 +524,19 @@ public class PurpleIRC extends JavaPlugin {
|
||||
|
||||
public void loadTemplates(YamlConfiguration config, String configName, String section) {
|
||||
messageTmpl.put(configName, new HashMap<String, String>());
|
||||
|
||||
ircHeroChannelMessages.put(configName, new CaseInsensitiveMap<String>());
|
||||
ircHeroActionChannelMessages.put(configName, new CaseInsensitiveMap<String>());
|
||||
ircTownyChannelMessages.put(configName, new CaseInsensitiveMap<String>());
|
||||
heroChannelMessages.put(configName, new CaseInsensitiveMap<String>());
|
||||
heroActionChannelMessages.put(configName, new CaseInsensitiveMap<String>());
|
||||
|
||||
ircMineverseChannelMessages.put(configName, new CaseInsensitiveMap<String>());
|
||||
ircMineverseActionChannelMessages.put(configName, new CaseInsensitiveMap<String>());
|
||||
mineverseChannelMessages.put(configName, new CaseInsensitiveMap<String>());
|
||||
mineverseActionChannelMessages.put(configName, new CaseInsensitiveMap<String>());
|
||||
|
||||
ircTownyChannelMessages.put(configName, new CaseInsensitiveMap<String>());
|
||||
|
||||
if (config.contains(section)) {
|
||||
for (String t : config.getConfigurationSection(section).getKeys(false)) {
|
||||
if (!t.startsWith("MemorySection")) {
|
||||
@ -530,7 +556,6 @@ public class PurpleIRC extends JavaPlugin {
|
||||
+ " => " + ircHeroChannelMessages.get(configName).get(hChannelName));
|
||||
}
|
||||
}
|
||||
|
||||
if (config.contains(section + ".irc-hero-action-channels")) {
|
||||
for (String hChannelName : config.getConfigurationSection(section + ".irc-hero-action-channels").getKeys(false)) {
|
||||
ircHeroActionChannelMessages.get(configName).put(hChannelName,
|
||||
@ -573,6 +598,48 @@ public class PurpleIRC extends JavaPlugin {
|
||||
+ " => " + heroActionChannelMessages.get(configName).get(hChannelName));
|
||||
}
|
||||
}
|
||||
|
||||
if (config.contains(section + ".mineverse-channels")) {
|
||||
for (String mvChannelName : config.getConfigurationSection(section + ".mineverse-channels").getKeys(false)) {
|
||||
mineverseChannelMessages.get(configName).put(mvChannelName,
|
||||
ChatColor.translateAlternateColorCodes('&',
|
||||
config.getString(section + ".mineverse-channels."
|
||||
+ mvChannelName)));
|
||||
logDebug(section + ".mineverse-channels: " + mvChannelName
|
||||
+ " => " + mineverseChannelMessages.get(configName).get(mvChannelName));
|
||||
}
|
||||
}
|
||||
if (config.contains(section + ".mineverse-action-channels")) {
|
||||
for (String mvChannelName : config.getConfigurationSection(section + ".mineverse-action-channels").getKeys(false)) {
|
||||
mineverseActionChannelMessages.get(configName).put(mvChannelName,
|
||||
ChatColor.translateAlternateColorCodes('&',
|
||||
config.getString(section + ".mineverse-action-channels."
|
||||
+ mvChannelName)));
|
||||
logDebug(section + ".mineverse-action-channels: " + mvChannelName
|
||||
+ " => " + mineverseActionChannelMessages.get(configName).get(mvChannelName));
|
||||
}
|
||||
}
|
||||
|
||||
if (config.contains(section + ".irc-mineverse-channels")) {
|
||||
for (String mvChannelName : config.getConfigurationSection(section + ".irc-mineverse-channels").getKeys(false)) {
|
||||
ircMineverseChannelMessages.get(configName).put(mvChannelName,
|
||||
ChatColor.translateAlternateColorCodes('&',
|
||||
config.getString(section + ".irc-mineverse-channels."
|
||||
+ mvChannelName)));
|
||||
logDebug(section + ".irc-mineverse-channels: " + mvChannelName
|
||||
+ " => " + ircMineverseChannelMessages.get(configName).get(mvChannelName));
|
||||
}
|
||||
}
|
||||
if (config.contains(section + ".irc-mineverse-action-channels")) {
|
||||
for (String mvChannelName : config.getConfigurationSection(section + ".irc-mineverse-action-channels").getKeys(false)) {
|
||||
ircMineverseActionChannelMessages.get(configName).put(mvChannelName,
|
||||
ChatColor.translateAlternateColorCodes('&',
|
||||
config.getString(section + ".irc-mineverse-action-channels."
|
||||
+ mvChannelName)));
|
||||
logDebug(section + ".irc-mineverse-action-channels: " + mvChannelName
|
||||
+ " => " + ircMineverseActionChannelMessages.get(configName).get(mvChannelName));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logDebug("No message-format section found for " + configName);
|
||||
}
|
||||
@ -1495,6 +1562,15 @@ public class PurpleIRC extends JavaPlugin {
|
||||
} else {
|
||||
hookList.add(hookFormat(PL_TITANCHAT, false));
|
||||
}
|
||||
if (isPluginEnabled(PL_MINEVERSECHAT)) {
|
||||
hookList.add(hookFormat(PL_MINEVERSECHAT, true));
|
||||
mineverseChatEnabled = true;
|
||||
mvHook = new MineverseChatHook(this);
|
||||
} else {
|
||||
hookList.add(hookFormat(PL_MINEVERSECHAT, false));
|
||||
mineverseChatEnabled = false;
|
||||
mvHook = null;
|
||||
}
|
||||
if (isPluginEnabled(PL_PRISM)) {
|
||||
hookList.add(hookFormat(PL_PRISM, true));
|
||||
getServer().getPluginManager().registerEvents(new PrismListener(this), this);
|
||||
@ -1672,6 +1748,14 @@ public class PurpleIRC extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
public void broadcastToPlayer(final Player player, final String message, final String permission) {
|
||||
getServer().getPluginManager().callEvent(new IRCMessageEvent(message, permission));
|
||||
String fixedMessage = message.replace("\u200B", "");
|
||||
if (player.hasPermission(permission)) {
|
||||
player.sendMessage(fixedMessage);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param cmd
|
||||
|
@ -54,6 +54,9 @@ public class TemplateName {
|
||||
|
||||
public final static String HERO_ACTION = "hero-action";
|
||||
public final static String HERO_CHAT = "hero-chat";
|
||||
|
||||
public final static String MINEVERSE_ACTION = "mineverse-action";
|
||||
public final static String MINEVERSE_CHAT = "mineverse-chat";
|
||||
|
||||
public final static String IRC_HERO_ACTION = "irc-hero-action";
|
||||
public final static String IRC_HERO_CHAT = "irc-hero-chat";
|
||||
@ -62,11 +65,22 @@ public class TemplateName {
|
||||
public final static String IRC_HERO_PART = "irc-hero-part";
|
||||
public final static String IRC_HERO_QUIT = "irc-hero-quit";
|
||||
public final static String IRC_HERO_TOPIC = "irc-hero-topic";
|
||||
|
||||
public final static String IRC_MINEVERSE_ACTION = "irc-mineverse-action";
|
||||
public final static String IRC_MINEVERSE_CHAT = "irc-mineverse-chat";
|
||||
public final static String IRC_MINEVERSE_KICK = "irc-mineverse-kick";
|
||||
public final static String IRC_MINEVERSE_JOIN = "irc-mineverse-join";
|
||||
public final static String IRC_MINEVERSE_PART = "irc-mineverse-part";
|
||||
public final static String IRC_MINEVERSE_QUIT = "irc-mineverse-quit";
|
||||
public final static String IRC_MINEVERSE_TOPIC = "irc-mineverse-topic";
|
||||
|
||||
public final static String IRC_ESS_HELPOP = "irc-ess-helpop";
|
||||
|
||||
public final static String IRC_HERO_CHANNELS = "irc-hero-channels";
|
||||
public final static String HERO_CHANNELS = "hero-channels";
|
||||
public final static String IRC_ACTION_CHANNELS = "irc-action-channels";
|
||||
|
||||
public final static String IRC_MINEVERSE_CHANNELS = "irc-mineverse-channels";
|
||||
public final static String MINEVERSE_CHANNELS = "mineverse-channels";
|
||||
|
||||
public final static String TITAN_CHAT = "titan-chat";
|
||||
public final static String IRC_TITAN_CHAT = "irc-titan-chat";
|
||||
|
@ -221,6 +221,34 @@ public class ChatTokenizer {
|
||||
.replace("%CHANNEL%", channel.getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* IRC to Mineverse chat channel tokenizer
|
||||
*
|
||||
* @param ircBot
|
||||
* @param user
|
||||
* @param channel
|
||||
* @param template
|
||||
* @param message
|
||||
* @param hChannel
|
||||
* @return
|
||||
*/
|
||||
public String ircChatToMineverseChatTokenizer(PurpleBot ircBot, User user, org.pircbotx.Channel channel, String template, String message, String hChannel) {
|
||||
String ircNick = user.getNick();
|
||||
String tmpl;
|
||||
Player player = this.getPlayer(ircNick);
|
||||
if (player != null) {
|
||||
tmpl = playerTokenizer(player, template);
|
||||
} else {
|
||||
tmpl = playerTokenizer(ircNick, template);
|
||||
}
|
||||
return plugin.colorConverter.ircColorsToGame(ircUserTokenizer(tmpl, user, ircBot)
|
||||
.replace("%MVCHANNEL%", hChannel)
|
||||
.replace("%NICKPREFIX%", ircBot.getNickPrefix(user, channel))
|
||||
.replace("%CHANNELPREFIX%", ircBot.getChannelPrefix(channel))
|
||||
.replace("%MESSAGE%", message)
|
||||
.replace("%CHANNEL%", channel.getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* IRC to Hero chat channel tokenizer
|
||||
*
|
||||
@ -480,13 +508,13 @@ public class ChatTokenizer {
|
||||
String template;
|
||||
switch (chatMode) {
|
||||
case "public":
|
||||
template = plugin.getMsgTemplate(botNick, "", TemplateName.FACTION_PUBLIC_CHAT);
|
||||
template = plugin.getMessageTemplate(botNick, "", TemplateName.FACTION_PUBLIC_CHAT);
|
||||
break;
|
||||
case "ally":
|
||||
template = plugin.getMsgTemplate(botNick, "", TemplateName.FACTION_ALLY_CHAT);
|
||||
template = plugin.getMessageTemplate(botNick, "", TemplateName.FACTION_ALLY_CHAT);
|
||||
break;
|
||||
case "enemy":
|
||||
template = plugin.getMsgTemplate(botNick, "", TemplateName.FACTION_ENEMY_CHAT);
|
||||
template = plugin.getMessageTemplate(botNick, "", TemplateName.FACTION_ENEMY_CHAT);
|
||||
break;
|
||||
default:
|
||||
return "";
|
||||
@ -549,6 +577,23 @@ public class ChatTokenizer {
|
||||
.replace("%CHANNEL%", tChannel);
|
||||
}
|
||||
|
||||
/**
|
||||
* MineverseChat to IRC
|
||||
*
|
||||
* @param player
|
||||
* @param mvChannel
|
||||
* @param mvColor
|
||||
* @param message
|
||||
* @param template
|
||||
* @return
|
||||
*/
|
||||
public String mineverseChatTokenizer(Player player, String mvChannel, String mvColor, String message, String template) {
|
||||
return gameChatToIRCTokenizer(player, template, message)
|
||||
.replace("%MVCHANNEL%", mvChannel)
|
||||
.replace("%MVCOLOR%", plugin.colorConverter.gameColorsToIrc(mvColor))
|
||||
.replace("%CHANNEL%", mvChannel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Game chat to IRC
|
||||
*
|
||||
@ -889,13 +934,13 @@ public class ChatTokenizer {
|
||||
.replace("%TARGET%", targetPlayer.getName())
|
||||
.replace("%MESSAGE%", message);
|
||||
}
|
||||
|
||||
|
||||
public String logTailerTokenizer(String file, String line, String template) {
|
||||
return plugin.colorConverter.gameColorsToIrc(template
|
||||
.replace("%FILE%", file)
|
||||
.replace("%LINE%", line));
|
||||
}
|
||||
|
||||
|
||||
public String addZeroWidthSpace(String s) {
|
||||
if (s.length() > 1) {
|
||||
String a = s.substring(0, 1);
|
||||
|
@ -245,6 +245,8 @@ channels:
|
||||
#- irc-a-chat
|
||||
# Hero channel destination for IRC messages
|
||||
hero-channel: admin
|
||||
# Mineverse channel destination for IRC messages
|
||||
mineverse-channel: global
|
||||
# Towny channel destination for IRC messages
|
||||
towny-channel: irc
|
||||
# Log all messages from IRC to HeroChat
|
||||
|
@ -165,6 +165,14 @@ message-format:
|
||||
irc-hero-part: '[&3IRC&r] %NAME% has left %CHANNEL%.'
|
||||
irc-hero-quit: '[&3IRC&r] %NAME% has left %CHANNEL%.'
|
||||
irc-hero-topic: '[&3IRC&r] Topic changed by %NAME%: %TOPIC%.'
|
||||
# Message templates for IRC to Mineversechat messages
|
||||
irc-mineverse-action: '[&3IRC&r] ***%NAME% %MESSAGE%'
|
||||
irc-mineverse-chat: '[&3IRC&r]<%NAME%> %MESSAGE%'
|
||||
irc-mineverse-join: '[&3IRC&r] %NAME% has joined %CHANNEL%.'
|
||||
irc-mineverse-kick: '[&3IRC&r] %NAME% was kicked from %CHANNEL% by %KICKER%. (Reason- %REASON%)'
|
||||
irc-mineverse-part: '[&3IRC&r] %NAME% has left %CHANNEL%.'
|
||||
irc-mineverse-quit: '[&3IRC&r] %NAME% has left %CHANNEL%.'
|
||||
irc-mineverse-topic: '[&3IRC&r] Topic changed by %NAME%: %TOPIC%.'
|
||||
# Message template for TitanChat to IRC messages
|
||||
titan-chat: '[%CHANNEL%]<%NAME%> %MESSAGE%'
|
||||
# Message templates for IRC to TitanChat messages
|
||||
@ -204,9 +212,49 @@ message-format:
|
||||
# Message format per hero channel. From game to IRC. Overrides hero-chat template.
|
||||
hero-channels:
|
||||
Global: '[%CHANNEL%]<%NAME%> %MESSAGE%'
|
||||
# Emote message format per hero channel. From game to IRC. Overrides hero-action template.
|
||||
# Emote message format per HeroChat channel. From game to IRC. Overrides hero-action template.
|
||||
hero-action-channels:
|
||||
Global: '[&2%CHANNEL%&r]***%NAME% %MESSAGE%'
|
||||
# Message format per MineverseChat channel. From IRC to game. Overrides mineverse-chat template.
|
||||
irc-mineverse-channels:
|
||||
Global: '&f[&2Global&f] [&4IRC&f] <%NAME%>&2: %MESSAGE%'
|
||||
Staff: '&f[&aStaff&f] [&4IRC&f] <%NAME%>&a: %MESSAGE%'
|
||||
Admin: '&f[&cAdmin&f] [&4IRC&f] <%NAME%>&c: %MESSAGE%'
|
||||
Donator: '&f[&dDonator&f] [&4IRC&f] <%NAME%>&d: %MESSAGE%'
|
||||
Help: '&f[&bHelp&f] [&4IRC&f] <%NAME%>&b: %MESSAGE%'
|
||||
Trade: '&f[&3Trade&f] [&4IRC&f] <%NAME%>&3: %MESSAGE%'
|
||||
Local: '&f[&eLocal&f] [&4IRC&f] <%NAME%>&e: %MESSAGE%'
|
||||
Network: '&f[&6Network&f] [&4IRC&f] <%NAME%>&6: %MESSAGE%'
|
||||
# Emote message format per MineverseChat channel. From IRC to game. Overrides mineverse-action template.
|
||||
irc-mineverse-action-channels:
|
||||
Global: '&f[&2Global&f] [&4IRC&f]***%NAME%&2: %MESSAGE%'
|
||||
Staff: '&f[&aStaff&f] [&4IRC&f]***%NAME%&a: %MESSAGE%'
|
||||
Admin: '&f[&cAdmin&f] [&4IRC&f]***%NAME%&c: %MESSAGE%'
|
||||
Donator: '&f[&dDonator&f] [&4IRC&f]***%NAME%&d: %MESSAGE%'
|
||||
Help: '&f[&bHelp&f] [&4IRC&f]***%NAME%&b: %MESSAGE%'
|
||||
Trade: '&f[&3Trade&f] [&4IRC&f]***%NAME%&3: %MESSAGE%'
|
||||
Local: '&f[&eLocal&f] [&4IRC&f]***%NAME%&e: %MESSAGE%'
|
||||
Network: '&f[&6Network&f] [&4IRC&f]***%NAME%&6: %MESSAGE%'
|
||||
# Message format per MineverseChat channel. From game to IRC. Overrides mineverse-chat template.
|
||||
mineverse-channels:
|
||||
Global: '&f[&2Global&f] <%NAME%>&2: %MESSAGE%'
|
||||
Staff: '&f[&aStaff&f] <%NAME%>&a: %MESSAGE%'
|
||||
Admin: '&f[&cAdmin&f] <%NAME%>&c: %MESSAGE%'
|
||||
Donator: '&f[&dDonator&f] <%NAME%>&d: %MESSAGE%'
|
||||
Help: '&f[&bHelp&f] <%NAME%>&b: %MESSAGE%'
|
||||
Trade: '&f[&3Trade&f] <%NAME%>&3: %MESSAGE%'
|
||||
Local: '&f[&eLocal&f] <%NAME%>&e: %MESSAGE%'
|
||||
Network: '&f[&6Network&f] <%NAME%>&6: %MESSAGE%'
|
||||
# Emote message format per MineverseChat channel. From game to IRC. Overrides mineverse-action template.
|
||||
mineverse-action-channels:
|
||||
Global: '&f[&2Global&f]***%NAME%&2: %MESSAGE%'
|
||||
Staff: '&f[&aStaff&f]***%NAME%&a: %MESSAGE%'
|
||||
Admin: '&f[&cAdmin&f]***%NAME%&c: %MESSAGE%'
|
||||
Donator: '&f[&dDonator&f]***%NAME%&d: %MESSAGE%'
|
||||
Help: '&f[&bHelp&f]***%NAME%&b: %MESSAGE%'
|
||||
Trade: '&f[&3Trade&f]***%NAME%&3: %MESSAGE%'
|
||||
Local: '&f[&eLocal&f]***%NAME%&e: %MESSAGE%'
|
||||
Network: '&f[&6Network&f]***%NAME%&6: %MESSAGE%'
|
||||
# Message templates for Towny to IRC messages
|
||||
towny-channel-chat: '%TOWNYCHANNELTAG%[%TOWNYCHANNEL%]<%NAME%> %MESSAGE%'
|
||||
# Message templates for IRC to Towny messages
|
||||
|
Loading…
Reference in New Issue
Block a user