Add irc-a-chat message type. Allows messages in channel to be sent directly to AdminPrivateChat

This commit is contained in:
cnaude 2015-02-22 16:53:07 -07:00
parent f412a99de6
commit b2377e409f
4 changed files with 26 additions and 3 deletions

View File

@ -2361,7 +2361,7 @@ public final class PurpleBot {
}
} else {
plugin.logDebug("NOPE we can't broadcast to HeroChat due to " + TemplateName.IRC_HERO_CHAT + " disabled");
}
}
if (plugin.isPluginEnabled("Essentials")) {
plugin.logDebug("Checking if " + TemplateName.IRC_ESS_HELPOP + " is enabled before broadcasting chat from IRC");
if (enabledMessages.get(myChannel).contains(TemplateName.IRC_ESS_HELPOP) || override) {
@ -2378,6 +2378,23 @@ public final class PurpleBot {
+ " disabled");
}
}
if (plugin.adminPrivateChatHook != null) {
plugin.logDebug("Checking if " + TemplateName.IRC_A_CHAT + " is enabled before broadcasting chat from IRC");
if (enabledMessages.get(myChannel).contains(TemplateName.IRC_A_CHAT) || override) {
plugin.logDebug("Yup we can broadcast due to " + TemplateName.IRC_A_CHAT + " enabled");
String newMessage = filterMessage(
plugin.tokenizer.ircChatToGameTokenizer(this, user, channel, plugin.getMsgTemplate(
botNick, TemplateName.IRC_A_CHAT), message), myChannel);
if (!newMessage.isEmpty()) {
plugin.adminPrivateChatHook.sendMessage(newMessage, user.getNick());
messageSent = true;
}
} else {
plugin.logDebug("NOPE we can't broadcast due to " + TemplateName.IRC_A_CHAT + " disabled");
}
}
if (enabledMessages.get(myChannel).contains(TemplateName.IRC_CHAT_RESPONSE) && messageSent && target != null) {
// Let the sender know the message was sent
String responseTemplate = plugin.getMsgTemplate(botNick, TemplateName.IRC_CHAT_RESPONSE);
@ -2389,6 +2406,7 @@ public final class PurpleBot {
}
}
}
}
// Broadcast chat messages from IRC to specific hero channel

View File

@ -127,6 +127,7 @@ public class TemplateName {
public final static String IRC_A_RESPONSE = "irc-a-response";
public final static String GAME_A_CHAT = "game-a-chat";
public final static String IRC_A_CHAT = "irc-a-chat";
public final static String FAKE_JOIN = "fake-join";
public final static String FAKE_QUIT = "fake-quit";

View File

@ -181,8 +181,10 @@ channels:
#- broadcast-message
# RedditStream
#- reddit-messages
# AdminPrivateChat messages
# AdminPrivateChat messages game to IRC
#- game-a-chat
# AdminPrivateChat messages IRC to game
#- irc-a-chat
# Hero channel destination for IRC messages
hero-channel: admin
# Towny channel destination for IRC messages

View File

@ -123,8 +123,10 @@ message-format:
irc-notice: '[&4IRC&r] [notice(%CHANNEL%)] %NOTICE% '
# AdminPrivateChat response message in IRC. Set to '' to disable.
irc-a-response: ' &6-> &7[AdminChat]: %MESSAGE%'
# AdinPrivateChat message from game to IRC
# AdminPrivateChat message from game to IRC
game-a-chat: '[%WORLD%] <%NAME%> -> [AdminChat]: %MESSAGE%'
# AdminPrivateChat message from IRC to game
irc-a-chat: '[&4IRC&r] %MESSAGE%'
# Message template for Clevernotch bot to IRC messages
clever-send: '[&4BOT]<%NAME%> %MESSAGE%'
# Message templates for mcMMO to IRC messages