diff options
author | KHobbits <rob@khobbits.co.uk> | 2013-01-20 21:52:23 +0000 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2013-01-20 22:05:44 +0000 |
commit | 443a317184e5cf499a069cb2a993a0a3dd994003 (patch) | |
tree | 6d3bee1c0ee5838dfa796f88ffcdebd6b3ac77cd | |
parent | 50dca9abf54d5a21d8e3fd79dfd7844d2d21f86c (diff) | |
download | Essentials-443a317184e5cf499a069cb2a993a0a3dd994003.tar Essentials-443a317184e5cf499a069cb2a993a0a3dd994003.tar.gz Essentials-443a317184e5cf499a069cb2a993a0a3dd994003.tar.lz Essentials-443a317184e5cf499a069cb2a993a0a3dd994003.tar.xz Essentials-443a317184e5cf499a069cb2a993a0a3dd994003.zip |
Show afk warning when pm'ing afk players.
Fix vanished leak on player matching.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandmsg.java | 39 | ||||
-rw-r--r-- | Essentials/src/messages.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_cs.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_da.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_de.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_en.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_es.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_fi.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_fr.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_it.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_nl.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_pl.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_pt.properties | 1 | ||||
-rw-r--r-- | Essentials/src/messages_se.properties | 1 |
14 files changed, 38 insertions, 14 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java index 6b6392cdb..398c96cfa 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java @@ -17,15 +17,15 @@ public class Commandmsg extends EssentialsCommand { super("msg"); } - + @Override public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception { - if (args.length < 2 || args[0].trim().length() < 2 || args[1].trim().isEmpty()) + if (args.length < 2 || args[0].trim().length() < 2 || args[1].trim().isEmpty()) { throw new NotEnoughArgumentsException(); } - + String message = getFinalArg(args, 1); if (sender instanceof Player) { @@ -40,12 +40,12 @@ public class Commandmsg extends EssentialsCommand { message = Util.replaceFormat(message); } - + final String translatedMe = _("me"); - + final IReplyTo replyTo = sender instanceof Player ? ess.getUser((Player)sender) : Console.getConsoleReplyTo(); final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; - + if (args[0].equalsIgnoreCase(Console.NAME)) { sender.sendMessage(_("msgFormat", translatedMe, Console.NAME, message)); @@ -55,14 +55,14 @@ public class Commandmsg extends EssentialsCommand Console.getConsoleReplyTo().setReplyTo(sender); return; } - + final List<Player> matchedPlayers = server.matchPlayer(args[0]); - + if (matchedPlayers.isEmpty()) { throw new Exception(_("playerNotFound")); } - + int i = 0; for (Player matchedPlayer : matchedPlayers) { @@ -76,17 +76,28 @@ public class Commandmsg extends EssentialsCommand { throw new Exception(_("playerNotFound")); } - + for (Player matchedPlayer : matchedPlayers) - { - sender.sendMessage(_("msgFormat", translatedMe, matchedPlayer.getDisplayName(), message)); + { final User matchedUser = ess.getUser(matchedPlayer); - if (sender instanceof Player && (matchedUser.isIgnoredPlayer(ess.getUser(sender)) || matchedUser.isHidden())) + + if (sender instanceof Player && matchedUser.isHidden()) + { + continue; + } + if (matchedUser.isAfk()) + { + sender.sendMessage(_("userAFK", matchedPlayer.getDisplayName())); + } + + sender.sendMessage(_("msgFormat", translatedMe, matchedPlayer.getDisplayName(), message)); + if (sender instanceof Player && matchedUser.isIgnoredPlayer(ess.getUser(sender))) { continue; } + matchedPlayer.sendMessage(_("msgFormat", senderName, translatedMe, message)); - replyTo.setReplyTo(ess.getUser(matchedPlayer)); + replyTo.setReplyTo(matchedUser); ess.getUser(matchedPlayer).setReplyTo(sender); } } diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 359e93982..47a3a478f 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all online players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all players messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} +userAFK=\u00a75{0} \u00a75is currently AFK and may not respond diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties index e6645a3b0..35d91bc40 100644 --- a/Essentials/src/messages_cs.properties +++ b/Essentials/src/messages_cs.properties @@ -496,3 +496,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} +userAFK=\u00a75{0} \u00a75is currently AFK and may not respond diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index f6f37e189..306f2ea9f 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} +userAFK=\u00a75{0} \u00a75is currently AFK and may not respond diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index f23e19a57..f8f42dcf7 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} +userAFK=\u00a75{0} \u00a75is currently AFK and may not respond diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 359e93982..47a3a478f 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all online players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all players messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} +userAFK=\u00a75{0} \u00a75is currently AFK and may not respond diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index e61d41ffb..06ee18bb8 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} +userAFK=\u00a75{0} \u00a75is currently AFK and may not respond diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties index 37021b744..c8d889975 100644 --- a/Essentials/src/messages_fi.properties +++ b/Essentials/src/messages_fi.properties @@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} +userAFK=\u00a75{0} \u00a75is currently AFK and may not respond diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index eb9bd09bc..c3dba0036 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} +userAFK=\u00a75{0} \u00a75is currently AFK and may not respond diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties index 496260802..887938960 100644 --- a/Essentials/src/messages_it.properties +++ b/Essentials/src/messages_it.properties @@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} +userAFK=\u00a75{0} \u00a75is currently AFK and may not respond diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index 0df6ca70e..332cc20ef 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} +userAFK=\u00a75{0} \u00a75is currently AFK and may not respond diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties index 825eb35d6..ba5212a5a 100644 --- a/Essentials/src/messages_pl.properties +++ b/Essentials/src/messages_pl.properties @@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} +userAFK=\u00a75{0} \u00a75is currently AFK and may not respond diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties index 69a8d2301..9327384c6 100644 --- a/Essentials/src/messages_pt.properties +++ b/Essentials/src/messages_pt.properties @@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} +userAFK=\u00a75{0} \u00a75is currently AFK and may not respond diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties index 0ddb94081..53095467a 100644 --- a/Essentials/src/messages_se.properties +++ b/Essentials/src/messages_se.properties @@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1} resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} +userAFK=\u00a75{0} \u00a75is currently AFK and may not respond |