Show afk warning when pm'ing afk players.

Fix vanished leak on player matching.
This commit is contained in:
KHobbits 2013-01-20 21:52:23 +00:00
parent 50dca9abf5
commit 443a317184
14 changed files with 38 additions and 14 deletions

View File

@ -21,7 +21,7 @@ public class Commandmsg extends EssentialsCommand
@Override @Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception 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(); throw new NotEnoughArgumentsException();
} }
@ -79,14 +79,25 @@ public class Commandmsg extends EssentialsCommand
for (Player matchedPlayer : matchedPlayers) for (Player matchedPlayer : matchedPlayers)
{ {
sender.sendMessage(_("msgFormat", translatedMe, matchedPlayer.getDisplayName(), message));
final User matchedUser = ess.getUser(matchedPlayer); final User matchedUser = ess.getUser(matchedPlayer);
if (sender instanceof Player && (matchedUser.isIgnoredPlayer(ess.getUser(sender)) || matchedUser.isHidden()))
if (sender instanceof Player && matchedUser.isHidden())
{ {
continue; 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)); matchedPlayer.sendMessage(_("msgFormat", senderName, translatedMe, message));
replyTo.setReplyTo(ess.getUser(matchedPlayer)); replyTo.setReplyTo(matchedUser);
ess.getUser(matchedPlayer).setReplyTo(sender); ess.getUser(matchedPlayer).setReplyTo(sender);
} }
} }

View File

@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all online players resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all online players
resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}
userAFK=\u00a75{0} \u00a75is currently AFK and may not respond

View File

@ -496,3 +496,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players 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 resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}
userAFK=\u00a75{0} \u00a75is currently AFK and may not respond

View File

@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players 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 resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}
userAFK=\u00a75{0} \u00a75is currently AFK and may not respond

View File

@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players 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 resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}
userAFK=\u00a75{0} \u00a75is currently AFK and may not respond

View File

@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all online players resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all online players
resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all players resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}
userAFK=\u00a75{0} \u00a75is currently AFK and may not respond

View File

@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players 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 resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}
userAFK=\u00a75{0} \u00a75is currently AFK and may not respond

View File

@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players 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 resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}
userAFK=\u00a75{0} \u00a75is currently AFK and may not respond

View File

@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players 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 resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}
userAFK=\u00a75{0} \u00a75is currently AFK and may not respond

View File

@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players 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 resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}
userAFK=\u00a75{0} \u00a75is currently AFK and may not respond

View File

@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players 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 resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}
userAFK=\u00a75{0} \u00a75is currently AFK and may not respond

View File

@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players 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 resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}
userAFK=\u00a75{0} \u00a75is currently AFK and may not respond

View File

@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players 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 resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}
userAFK=\u00a75{0} \u00a75is currently AFK and may not respond

View File

@ -493,3 +493,4 @@ muteNotify=\u00a74{0} \u00a76has muted \u00a74{1}
resetBal=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all online players 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 resetBalAll=\u00a76Balance has been reset to \u00a7a{0} \u00a76 for all players
messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1} messageTruncated=\u00a74Message truncated, to see the full output type:\u00a7c /{0} {1}
userAFK=\u00a75{0} \u00a75is currently AFK and may not respond