mirror of
https://github.com/cnaude/PurpleIRC-spigot.git
synced 2024-11-29 05:26:19 +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.logDebug("Dispatching command as ConsoleSender: " + ircCommand.getGameCommand());
|
||||||
|
|
||||||
plugin.getServer().dispatchCommand(ircCommand.getIRCConsoleCommandSender(), 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 {
|
} else {
|
||||||
plugin.logDebug("Dispatching command as IRCCommandSender: " + ircCommand.getGameCommand());
|
plugin.logDebug("Dispatching command as IRCCommandSender: " + ircCommand.getGameCommand());
|
||||||
plugin.getServer().dispatchCommand(ircCommand.getIRCCommandSender(), ircCommand.getGameCommand());
|
plugin.getServer().dispatchCommand(ircCommand.getIRCCommandSender(), ircCommand.getGameCommand());
|
||||||
|
@ -45,9 +45,11 @@ public class IRCCommandSender implements CommandSender {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void sendMessage(String message) {
|
public void sendMessage(String message) {
|
||||||
|
if (!message.isEmpty()) {
|
||||||
plugin.logDebug("sendMessage: " + message);
|
plugin.logDebug("sendMessage: " + message);
|
||||||
addMessageToQueue(template.replace("%RESULT%", message));
|
addMessageToQueue(template.replace("%RESULT%", message));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -56,10 +58,12 @@ public class IRCCommandSender implements CommandSender {
|
|||||||
@Override
|
@Override
|
||||||
public void sendMessage(String[] messages) {
|
public void sendMessage(String[] messages) {
|
||||||
for (String message : messages) {
|
for (String message : messages) {
|
||||||
|
if (!message.isEmpty()) {
|
||||||
plugin.logDebug("sendMessage[]: " + message);
|
plugin.logDebug("sendMessage[]: " + message);
|
||||||
addMessageToQueue(template.replace("%RESULT%", message));
|
addMessageToQueue(template.replace("%RESULT%", message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void addMessageToQueue(String message) {
|
private void addMessageToQueue(String message) {
|
||||||
ircBot.messageQueue.add(new IRCMessage(target,
|
ircBot.messageQueue.add(new IRCMessage(target,
|
||||||
|
@ -46,9 +46,11 @@ public class IRCConsoleCommandSender implements ConsoleCommandSender {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void sendMessage(String message) {
|
public void sendMessage(String message) {
|
||||||
|
if (!message.isEmpty()) {
|
||||||
plugin.logDebug("sendMessage: " + message);
|
plugin.logDebug("sendMessage: " + message);
|
||||||
addMessageToQueue(message);
|
addMessageToQueue(message);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -57,10 +59,12 @@ public class IRCConsoleCommandSender implements ConsoleCommandSender {
|
|||||||
@Override
|
@Override
|
||||||
public void sendMessage(String[] messages) {
|
public void sendMessage(String[] messages) {
|
||||||
for (String message : messages) {
|
for (String message : messages) {
|
||||||
|
if (!message.isEmpty()) {
|
||||||
plugin.logDebug("sendMessage[]: " + message);
|
plugin.logDebug("sendMessage[]: " + message);
|
||||||
addMessageToQueue(message);
|
addMessageToQueue(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void addMessageToQueue(String message) {
|
private void addMessageToQueue(String message) {
|
||||||
ircBot.messageQueue.add(new IRCMessage(target,
|
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 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
|
* @param sender
|
||||||
|
@ -96,6 +96,8 @@ message-format:
|
|||||||
console-chat: '[&dServer&r] %MESSAGE%'
|
console-chat: '[&dServer&r] %MESSAGE%'
|
||||||
# Cross server chatting via linked bots
|
# Cross server chatting via linked bots
|
||||||
cross-chat: '[&4%SERVER%&r] %MESSAGE%'
|
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-achievement: '[&2%WORLD%&r] %NAME% has just earned the achievement [%MESSAGE%]'
|
||||||
game-mode: '[&2%WORLD%&r] %NAME% has changed game mode: [%MESSAGE%]'
|
game-mode: '[&2%WORLD%&r] %NAME% has changed game mode: [%MESSAGE%]'
|
||||||
game-action: '[&2%WORLD%&r]***%NAME% %MESSAGE%'
|
game-action: '[&2%WORLD%&r]***%NAME% %MESSAGE%'
|
||||||
|
Loading…
Reference in New Issue
Block a user