Add new command-sent message template.

This commit is contained in:
cnaude 2016-01-06 22:57:44 -07:00
parent 8411d2178c
commit 1e814a3a30
6 changed files with 32 additions and 10 deletions

View File

@ -68,7 +68,7 @@ public class CommandQueueWatcher {
plugin.logDebug("Dispatching command as ConsoleSender: " + ircCommand.getGameCommand());
plugin.getServer().dispatchCommand(ircCommand.getIRCConsoleCommandSender(), ircCommand.getGameCommand());
ircCommand.getIRCConsoleCommandSender().sendMessage("Command sent: " + ircCommand.getGameCommand());
ircCommand.getIRCConsoleCommandSender().sendMessage(plugin.tokenizer.ircCommandSentTokenizer(ircCommand.getGameCommand()));
} else {
plugin.logDebug("Dispatching command as IRCCommandSender: " + ircCommand.getGameCommand());
plugin.getServer().dispatchCommand(ircCommand.getIRCCommandSender(), ircCommand.getGameCommand());

View File

@ -45,8 +45,10 @@ public class IRCCommandSender implements CommandSender {
*/
@Override
public void sendMessage(String message) {
plugin.logDebug("sendMessage: " + message);
addMessageToQueue(template.replace("%RESULT%", message));
if (!message.isEmpty()) {
plugin.logDebug("sendMessage: " + message);
addMessageToQueue(template.replace("%RESULT%", message));
}
}
/**
@ -56,8 +58,10 @@ public class IRCCommandSender implements CommandSender {
@Override
public void sendMessage(String[] messages) {
for (String message : messages) {
plugin.logDebug("sendMessage[]: " + message);
addMessageToQueue(template.replace("%RESULT%", message));
if (!message.isEmpty()) {
plugin.logDebug("sendMessage[]: " + message);
addMessageToQueue(template.replace("%RESULT%", message));
}
}
}

View File

@ -46,8 +46,10 @@ public class IRCConsoleCommandSender implements ConsoleCommandSender {
*/
@Override
public void sendMessage(String message) {
plugin.logDebug("sendMessage: " + message);
addMessageToQueue(message);
if (!message.isEmpty()) {
plugin.logDebug("sendMessage: " + message);
addMessageToQueue(message);
}
}
/**
@ -57,8 +59,10 @@ public class IRCConsoleCommandSender implements ConsoleCommandSender {
@Override
public void sendMessage(String[] messages) {
for (String message : messages) {
plugin.logDebug("sendMessage[]: " + message);
addMessageToQueue(message);
if (!message.isEmpty()) {
plugin.logDebug("sendMessage[]: " + message);
addMessageToQueue(message);
}
}
}

View File

@ -163,4 +163,6 @@ public class TemplateName {
public final static String LOG_TAILER = "log-tailer";
public final static String COMMAND_SENT = "command-sent";
}

View File

@ -993,6 +993,16 @@ public class ChatTokenizer {
);
}
/**
*
* @param command
* @return
*/
public String ircCommandSentTokenizer(String command) {
return plugin.getMessageTemplate(TemplateName.COMMAND_SENT)
.replace("%COMMAND%", command);
}
/**
*
* @param sender

View File

@ -96,6 +96,8 @@ message-format:
console-chat: '[&dServer&r] %MESSAGE%'
# Cross server chatting via linked bots
cross-chat: '[&4%SERVER%&r] %MESSAGE%'
# Command sent notification. Blank this to disable this message.
command-sent: 'Command sent: %COMMAND%'
game-achievement: '[&2%WORLD%&r] %NAME% has just earned the achievement [%MESSAGE%]'
game-mode: '[&2%WORLD%&r] %NAME% has changed game mode: [%MESSAGE%]'
game-action: '[&2%WORLD%&r]***%NAME% %MESSAGE%'