Add missing IRC->VentureChat messages. (join, kick, part, quit)

This commit is contained in:
cnaude 2016-07-26 18:19:59 -07:00
parent 6f08a02b36
commit aeeeb18d2b
3 changed files with 87 additions and 17 deletions

View File

@ -84,7 +84,7 @@ public class VentureChatListener implements Listener {
String channelTemplateName = "venture-" + vcChannel + "-chat";
if (bot.isMessageEnabled(channelName, channelTemplateName)
|| bot.isMessageEnabled(channelName, TemplateName.VENTURE_CHAT)) {
String template = plugin.getVentureChatTemplate(bot.botNick, vcChannel);
String template = plugin.getVentureChatTemplate(bot.botNick, vcChannel, TemplateName.VENTURE_CHAT);
plugin.logDebug("VC Template: " + template);
bot.asyncIRCMessage(channelName, plugin.tokenizer
.ventureChatTokenizer(player, vcChannel, vcColor, message, template));

View File

@ -2823,7 +2823,7 @@ public final class PurpleBot {
*/
if (isMessageEnabled(channelName, TemplateName.IRC_VENTURE_CHAT) && plugin.ventureChatEnabled) {
String vcChannel = ventureChatChannel.get(channelName);
String vcTemplate = plugin.getIrcVentureChatTemplate(botNick, vcChannel);
String vcTemplate = plugin.getVentureChatTemplate(botNick, vcChannel, TemplateName.IRC_VENTURE_CHAT);
plugin.logDebug("broadcastChat [MV]: " + vcChannel + ": " + vcTemplate);
String rawMvMessage = filterMessage(
plugin.tokenizer.ircChatToVentureChatTokenizer(this, user, channel, vcTemplate, message, vcChannel), channelName);
@ -3108,6 +3108,22 @@ public final class PurpleBot {
)
);
}
// Broadcast kick message to VentureChat
if (isMessageEnabled(channelName, TemplateName.IRC_VENTURE_KICK) && plugin.ventureChatEnabled) {
String vcChannel = ventureChatChannel.get(channelName);
String vcTemplate = plugin.getVentureChatTemplate(botNick, vcChannel, TemplateName.IRC_VENTURE_KICK);
plugin.logDebug("broadcastIRCkick [VC]: " + vcChannel + ": " + vcTemplate);
String rawVcMessage = plugin.tokenizer.ircKickTokenizer(this, recipient, kicker, reason, channel, vcTemplate);
if (!rawVcMessage.isEmpty()) {
plugin.vcHook.sendMessage(vcChannel, rawVcMessage);
if (logIrcToVentureChat.containsKey(channelName)) {
if (logIrcToVentureChat.get(channelName)) {
plugin.getServer().getConsoleSender().sendMessage(rawVcMessage);
}
}
}
}
}
/**
@ -3165,6 +3181,7 @@ public final class PurpleBot {
plugin.logDebug("[broadcastIRCJoin] NOT broadcasting join message because irc-join is false.");
}
// Broadcast join message to HeroChat
if (isMessageEnabled(channel, TemplateName.IRC_HERO_JOIN)) {
Herochat.getChannelManager().getChannel(heroChannel.get(channel.getName()))
.sendRawMessage(plugin.tokenizer.ircChatToHeroChatTokenizer(
@ -3173,6 +3190,23 @@ public final class PurpleBot {
Herochat.getChannelManager(),
heroChannel.get(channel.getName())));
}
// Broadcast join message to VentureChat
if (isMessageEnabled(channelName, TemplateName.IRC_VENTURE_JOIN) && plugin.ventureChatEnabled) {
String vcChannel = ventureChatChannel.get(channelName);
String vcTemplate = plugin.getVentureChatTemplate(botNick, vcChannel, TemplateName.IRC_VENTURE_JOIN);
plugin.logDebug("broadcastIRCJoin [VC]: " + vcChannel + ": " + vcTemplate);
String rawVcMessage = plugin.tokenizer.chatIRCTokenizer(this, user, channel, vcTemplate);
if (!rawVcMessage.isEmpty()) {
plugin.vcHook.sendMessage(vcChannel, rawVcMessage);
if (logIrcToVentureChat.containsKey(channelName)) {
if (logIrcToVentureChat.get(channelName)) {
plugin.getServer().getConsoleSender().sendMessage(rawVcMessage);
}
}
}
}
}
public void broadcastIRCPart(User user, org.pircbotx.Channel channel) {
@ -3196,6 +3230,22 @@ public final class PurpleBot {
Herochat.getChannelManager(),
heroChannel.get(channel.getName())));
}
// Broadcast part message to VentureChat
if (isMessageEnabled(channelName, TemplateName.IRC_VENTURE_PART) && plugin.ventureChatEnabled) {
String vcChannel = ventureChatChannel.get(channelName);
String vcTemplate = plugin.getVentureChatTemplate(botNick, vcChannel, TemplateName.IRC_VENTURE_PART);
plugin.logDebug("broadcastIRCPart [VC]: " + vcChannel + ": " + vcTemplate);
String rawVcMessage = plugin.tokenizer.chatIRCTokenizer(this, user, channel, vcTemplate);
if (!rawVcMessage.isEmpty()) {
plugin.vcHook.sendMessage(vcChannel, rawVcMessage);
if (logIrcToVentureChat.containsKey(channelName)) {
if (logIrcToVentureChat.get(channelName)) {
plugin.getServer().getConsoleSender().sendMessage(rawVcMessage);
}
}
}
}
}
public void broadcastIRCQuit(User user, org.pircbotx.Channel channel, String reason) {
@ -3219,6 +3269,22 @@ public final class PurpleBot {
Herochat.getChannelManager(),
heroChannel.get(channel.getName())));
}
// Broadcast part message to VentureChat
if (isMessageEnabled(channelName, TemplateName.IRC_VENTURE_QUIT) && plugin.ventureChatEnabled) {
String vcChannel = ventureChatChannel.get(channelName);
String vcTemplate = plugin.getVentureChatTemplate(botNick, vcChannel, TemplateName.IRC_VENTURE_QUIT);
plugin.logDebug("broadcastIRCQuit [VC]: " + vcChannel + ": " + vcTemplate);
String rawVcMessage = plugin.tokenizer.chatIRCTokenizer(this, user, channel, vcTemplate);
if (!rawVcMessage.isEmpty()) {
plugin.vcHook.sendMessage(vcChannel, rawVcMessage);
if (logIrcToVentureChat.containsKey(channelName)) {
if (logIrcToVentureChat.get(channelName)) {
plugin.getServer().getConsoleSender().sendMessage(rawVcMessage);
}
}
}
}
}
@ -3244,6 +3310,22 @@ public final class PurpleBot {
Herochat.getChannelManager(),
heroChannel.get(channel.getName())));
}
// Broadcast topic message to VentureChat
if (isMessageEnabled(channelName, TemplateName.IRC_VENTURE_TOPIC) && plugin.ventureChatEnabled) {
String vcChannel = ventureChatChannel.get(channelName);
String vcTemplate = plugin.getVentureChatTemplate(botNick, vcChannel, TemplateName.IRC_VENTURE_TOPIC);
plugin.logDebug("broadcastIRCTopic [VC]: " + vcChannel + ": " + vcTemplate);
String rawVcMessage = plugin.tokenizer.chatIRCTokenizer(this, user, channel, vcTemplate);
if (!rawVcMessage.isEmpty()) {
plugin.vcHook.sendMessage(vcChannel, rawVcMessage);
if (logIrcToVentureChat.containsKey(channelName)) {
if (logIrcToVentureChat.get(channelName)) {
plugin.getServer().getConsoleSender().sendMessage(rawVcMessage);
}
}
}
}
}
/**

View File

@ -504,21 +504,9 @@ public class PurpleIRC extends JavaPlugin {
public String getIrcHeroActionTemplate(String botName, String channel) {
return getMessageTemplate(ircHeroActionChannelMessages, botName, channel, TemplateName.IRC_HERO_ACTION);
}
public String getVentureChatTemplate(String botName, String channel) {
return getMessageTemplate(ventureChatChannelMessages, botName, channel, TemplateName.VENTURE_CHAT);
}
public String getVentureChatActionTemplate(String botName, String channel) {
return getMessageTemplate(ventureChatActionChannelMessages, botName, channel, TemplateName.VENTURE_CHAT_ACTION);
}
public String getIrcVentureChatTemplate(String botName, String channel) {
return getMessageTemplate(ircVentureChatChannelMessages, botName, channel, TemplateName.IRC_VENTURE_CHAT);
}
public String getIrcVentureChatActionTemplate(String botName, String channel) {
return getMessageTemplate(ircVentureChatActionChannelMessages, botName, channel, TemplateName.IRC_VENTURE_ACTION);
public String getVentureChatTemplate(String botName, String channel, String template) {
return getMessageTemplate(ircVentureChatChannelMessages, botName, channel, template);
}
public String getIrcTownyChatTemplate(String botName, String channel) {