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,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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,5 +162,7 @@ public class TemplateName {
|
||||
public final static String NTHE_END_AGAIN_CRYSTAL = "ntheendagain-crystal";
|
||||
|
||||
public final static String LOG_TAILER = "log-tailer";
|
||||
|
||||
public final static String COMMAND_SENT = "command-sent";
|
||||
|
||||
}
|
||||
|
@ -992,6 +992,16 @@ public class ChatTokenizer {
|
||||
.replace("%MESSAGE%", message)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param command
|
||||
* @return
|
||||
*/
|
||||
public String ircCommandSentTokenizer(String command) {
|
||||
return plugin.getMessageTemplate(TemplateName.COMMAND_SENT)
|
||||
.replace("%COMMAND%", command);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -91,11 +91,13 @@ chat-ping-fix: false
|
||||
# %ACTION%
|
||||
# %MESSAGE%
|
||||
# %PLUGIN%
|
||||
message-format:
|
||||
message-format:
|
||||
# Message templates for game to IRC messages
|
||||
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