diff options
author | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-04-05 18:14:18 +0000 |
---|---|---|
committer | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-04-05 18:14:18 +0000 |
commit | a3dc43bcaf8d226218c6e98c065e012766fbfa6a (patch) | |
tree | cdb1b87c367f5f9d5cb84602493841d047159e96 | |
parent | a99800d58e1830fe9c344420337606c1795357e9 (diff) | |
download | Essentials-a3dc43bcaf8d226218c6e98c065e012766fbfa6a.tar Essentials-a3dc43bcaf8d226218c6e98c065e012766fbfa6a.tar.gz Essentials-a3dc43bcaf8d226218c6e98c065e012766fbfa6a.tar.lz Essentials-a3dc43bcaf8d226218c6e98c065e012766fbfa6a.tar.xz Essentials-a3dc43bcaf8d226218c6e98c065e012766fbfa6a.zip |
[trunk] /msg /r Reply to the console. Add /r console command.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1134 e251c2fe-e539-e718-e476-b85c1f46cddb
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandmsg.java | 4 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandr.java | 16 |
2 files changed, 11 insertions, 9 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java index 422dc97a9..c14bfa72e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java @@ -33,8 +33,8 @@ public class Commandmsg extends EssentialsCommand String message = getFinalArg(args, 1); - IReplyTo replyTo = sender instanceof User?(User)sender:Console.getConsoleReplyTo(); - String senderName = sender instanceof User?((User)sender).getDisplayName():Console.NAME; + IReplyTo replyTo = sender instanceof Player?User.get((Player)sender):Console.getConsoleReplyTo(); + String senderName = sender instanceof Player?((Player)sender).getDisplayName():Console.NAME; if (args[0].equalsIgnoreCase(Console.NAME)) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandr.java b/Essentials/src/com/earth2me/essentials/commands/Commandr.java index 9b2aa9233..fe12562ee 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandr.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandr.java @@ -25,10 +25,10 @@ public class Commandr extends EssentialsCommand } String message = getFinalArg(args, 0); - IReplyTo replyTo = sender instanceof User?(User)sender:Console.getConsoleReplyTo(); - String senderName = sender instanceof User?((User)sender).getDisplayName():Console.NAME; + IReplyTo replyTo = sender instanceof Player?User.get((Player)sender):Console.getConsoleReplyTo(); + String senderName = sender instanceof Player?((Player)sender).getDisplayName():Console.NAME; CommandSender target = replyTo.getReplyTo(); - String targetName = target instanceof User?((User)target).getDisplayName():Console.NAME; + String targetName = target instanceof Player?((Player)target).getDisplayName():Console.NAME; if (target == null) { @@ -39,10 +39,12 @@ public class Commandr extends EssentialsCommand sender.sendMessage("[Me -> " + targetName + "] " + message); target.sendMessage("[" + senderName + " -> Me] " + message); replyTo.setReplyTo(target); - if (target instanceof Player) { - User.get((Player)target).setReplyTo(sender); - } else { - Console.getConsoleReplyTo().setReplyTo(sender); + if (target != sender) { + if (target instanceof Player) { + User.get((Player)target).setReplyTo(sender); + } else { + Console.getConsoleReplyTo().setReplyTo(sender); + } } } } |