Add %ARGX% tokens for game_command where X is any number.

This commit is contained in:
cnaude 2015-07-15 18:33:59 -07:00
parent 0ae7cc9027
commit 5b631cd60a

View File

@ -184,6 +184,15 @@ public class IRCMessageHandler {
if (gameCommand.contains("%ARGS%")) { if (gameCommand.contains("%ARGS%")) {
gameCommand = gameCommand.replace("%ARGS%", commandArgs); gameCommand = gameCommand.replace("%ARGS%", commandArgs);
} }
if (gameCommand.matches(".*%ARG\\d+%.*")) {
String commandArgsArray[] = commandArgs.split(" ");
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%")) { if (gameCommand.contains("%NAME%")) {
gameCommand = gameCommand.replace("%NAME%", user.getNick()); gameCommand = gameCommand.replace("%NAME%", user.getNick());
} }