Fix irc-a-chat

This commit is contained in:
cnaude 2015-07-18 14:50:52 -07:00
parent ea3a0ae035
commit aa08c80d7a

View File

@ -41,7 +41,7 @@ public class IRCMessageHandler {
public IRCMessageHandler(PurpleIRC plugin) {
this.plugin = plugin;
}
private void sendFloodWarning(User user, PurpleBot ircBot) {
String message = plugin.colorConverter.gameColorsToIrc(plugin.getMsgTemplate(
ircBot.botNick, "", TemplateName.IRC_FLOOD_WARNING)
@ -170,7 +170,10 @@ public class IRCMessageHandler {
break;
case "@a":
if (plugin.adminPrivateChatHook != null) {
plugin.adminPrivateChatHook.sendMessage(commandArgs, user.getNick());
String newMessage = ircBot.filterMessage(
plugin.tokenizer.ircChatToGameTokenizer(ircBot, user, channel, plugin.getMsgTemplate(
ircBot.botNick, channelName, TemplateName.IRC_A_CHAT), commandArgs), channelName);
plugin.adminPrivateChatHook.sendMessage(newMessage, user.getNick());
String acResponse = plugin.tokenizer.msgChatResponseTokenizer(target, commandArgs, plugin.getMsgTemplate(TemplateName.IRC_A_RESPONSE));
if (!acResponse.isEmpty()) {
sendMessage(ircBot, target, acResponse, ctcpResponse);
@ -184,15 +187,15 @@ public class IRCMessageHandler {
if (gameCommand.contains("%ARGS%")) {
gameCommand = gameCommand.replace("%ARGS%", commandArgs);
}
if (gameCommand.matches(".*%ARG\\d+%.*")) {
String commandArgsArray[] = commandArgs.split(" ");
for (int i = 0; i < commandArgsArray.length; i ++) {
for (int i = 0; i < commandArgsArray.length; i++) {
gameCommand = gameCommand.replace("%ARG" + (i + 1) + "%", commandArgsArray[i]);
}
gameCommand = gameCommand.replaceAll("%ARG\\d+%", "");
}
}
if (gameCommand.contains("%NAME%")) {
gameCommand = gameCommand.replace("%NAME%", user.getNick());
}