diff --git a/Essentials/src/com/earth2me/essentials/messaging/SimpleMessageRecipient.java b/Essentials/src/com/earth2me/essentials/messaging/SimpleMessageRecipient.java index 612daeb69..b5a2fb7dc 100644 --- a/Essentials/src/com/earth2me/essentials/messaging/SimpleMessageRecipient.java +++ b/Essentials/src/com/earth2me/essentials/messaging/SimpleMessageRecipient.java @@ -17,7 +17,7 @@ import java.lang.ref.WeakReference; *
  • {@link IMessageRecipient#getReplyRecipient()}
  • *
  • {@link IMessageRecipient#setReplyRecipient(IMessageRecipient)}
  • * - * + * * The given {@code parent} must implement the following methods to prevent overflow: * - * + * * The reply-recipient is wrapped in a {@link WeakReference}. */ public class SimpleMessageRecipient implements IMessageRecipient { private final IEssentials ess; private final IMessageRecipient parent; - + private long lastMessageMs; private WeakReference replyRecipient; @@ -42,7 +42,7 @@ public class SimpleMessageRecipient implements IMessageRecipient { } return recipient instanceof User ? (User) recipient : null; } - + public SimpleMessageRecipient(IEssentials ess, IMessageRecipient parent) { this.ess = ess; this.parent = parent; @@ -117,13 +117,12 @@ public class SimpleMessageRecipient implements IMessageRecipient { if (!isReachable()) { return MessageResponse.UNREACHABLE; } - + User user = getUser(this); boolean afk = false; if (user != null) { - if (user.isIgnoreMsg() - && !(sender instanceof Console)) { // Console must never be ignored. - return MessageResponse.MESSAGES_IGNORED; + if (user.isIgnoreMsg() && sender instanceof IUser && !((IUser) sender).isAuthorized("essentials.msgtoggle.bypass")) { // Don't ignore console and senders with permission + return MessageResponse.MESSAGES_IGNORED; } afk = user.isAfk(); // Check whether this recipient ignores the sender, only if the sender is not the console. @@ -138,7 +137,7 @@ public class SimpleMessageRecipient implements IMessageRecipient { // If this recipient doesn't have a reply recipient, initiate by setting the first // message sender to this recipient's replyRecipient. long timeout = ess.getSettings().getLastMessageReplyRecipientTimeout() * 1000; - if (getReplyRecipient() == null || !getReplyRecipient().isReachable() + if (getReplyRecipient() == null || !getReplyRecipient().isReachable() || System.currentTimeMillis() - this.lastMessageMs > timeout) { setReplyRecipient(sender); }