mirror of
https://github.com/cnaude/PurpleIRC-spigot.git
synced 2024-11-25 19:45:54 +01:00
Add new command-sent message template.
This commit is contained in:
parent
8411d2178c
commit
1e814a3a30
@ -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());
|
||||
|
@ -45,9 +45,11 @@ public class IRCCommandSender implements CommandSender {
|
||||
*/
|
||||
@Override
|
||||
public void sendMessage(String message) {
|
||||
if (!message.isEmpty()) {
|
||||
plugin.logDebug("sendMessage: " + message);
|
||||
addMessageToQueue(template.replace("%RESULT%", message));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@ -56,10 +58,12 @@ public class IRCCommandSender implements CommandSender {
|
||||
@Override
|
||||
public void sendMessage(String[] messages) {
|
||||
for (String message : messages) {
|
||||
if (!message.isEmpty()) {
|
||||
plugin.logDebug("sendMessage[]: " + message);
|
||||
addMessageToQueue(template.replace("%RESULT%", message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addMessageToQueue(String message) {
|
||||
ircBot.messageQueue.add(new IRCMessage(target,
|
||||
|
@ -46,9 +46,11 @@ public class IRCConsoleCommandSender implements ConsoleCommandSender {
|
||||
*/
|
||||
@Override
|
||||
public void sendMessage(String message) {
|
||||
if (!message.isEmpty()) {
|
||||
plugin.logDebug("sendMessage: " + message);
|
||||
addMessageToQueue(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@ -57,10 +59,12 @@ public class IRCConsoleCommandSender implements ConsoleCommandSender {
|
||||
@Override
|
||||
public void sendMessage(String[] messages) {
|
||||
for (String message : messages) {
|
||||
if (!message.isEmpty()) {
|
||||
plugin.logDebug("sendMessage[]: " + message);
|
||||
addMessageToQueue(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addMessageToQueue(String message) {
|
||||
ircBot.messageQueue.add(new IRCMessage(target,
|
||||
|
@ -163,4 +163,6 @@ public class TemplateName {
|
||||
|
||||
public final static String LOG_TAILER = "log-tailer";
|
||||
|
||||
public final static String COMMAND_SENT = "command-sent";
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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%'
|
||||
|
Loading…
Reference in New Issue
Block a user