Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #15 from CelticMinstrel/master

Fixed the capture of console say command
  • Loading branch information...
commit 8a6647952151022bb3ec0a377b5e5e4cbc8f93c0 2 parents c36b224 + e6082d6
Protected authored
Showing with 12 additions and 11 deletions.
  1. +9 −11 com/ensifera/animosity/craftirc/CraftIRC.java
  2. +3 −0  plugin.yml
View
20 com/ensifera/animosity/craftirc/CraftIRC.java
@@ -218,14 +218,17 @@ public boolean onCommand(CommandSender sender, Command command, String commandLa
} else if (commandName.equals("say")) {
// Capture the 'say' command from Minecraft Console
- if (sender instanceof Server) {
+ if (sender instanceof ConsoleCommandSender) {
RelayedMessage msg = this.newMsg(EndPoint.GAME, EndPoint.IRC);
msg.formatting = "chat";
msg.sender = "[CONSOLE]";
- msg.message = Util.combineSplit(1, args, " ");
- this.sendMessage(msg, null, "game-to-irc");
- }
-
+ String message = Util.combineSplit(0, args, " ");
+ msg.message = message;
+ this.sendMessage(msg, null, "console");
+ // And replicate the default effect of the 'say' command...
+ this.getServer().broadcastMessage(ChatColor.LIGHT_PURPLE + "[Server] " + message);
+ sender.sendMessage("[CONSOLE] " + message);
+ }
} else
return false;
@@ -436,11 +439,6 @@ protected void sendMsgToTargetViaBot(String message, String target, int bot) {
* @param rawMessage
* @param tag
*/
- private void sendRawToBotViaTag(String rawMessage, String tag) {
- if (this.isDebug()) CraftIRC.log.info(String.format(CraftIRC.NAME + " sendRawToBot(tag=" + tag + ", message=" + rawMessage));
- //Minebot target = instances.get(bot);
- //target.sendRawLineViaQueue(message);
- }
/**
* CraftIRC API call - sendMessageToTag() Sends a message to an IRC tag
*
@@ -454,7 +452,7 @@ private void sendRawToBotViaTag(String rawMessage, String tag) {
public void sendMessageToTag(String message, String tag) {
RelayedMessage rm = newMsg(EndPoint.PLUGIN, EndPoint.IRC);
rm.message = message;
- this.sendMessage(rm, tag, null);
+ this.sendMessage(rm, tag, "custom");
}
/** TODO: MAKE THIS
View
3  plugin.yml
@@ -20,3 +20,6 @@ commands:
ircraw:
description: Sends a raw line to IRC
usage: /<command> [botid] [rawirc]
+ say:
+ description: Broadcast a message to everyone, including IRC
+ usage: /<command> [message]
Please sign in to comment.
Something went wrong with that request. Please try again.