mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-07-09 23:37:58 +00:00
Add command to toggle reply player functionality
This commit is contained in:
parent
25ddaef423
commit
f68fb52af1
7 changed files with 77 additions and 7 deletions
|
@ -1,13 +1,13 @@
|
|||
package com.earth2me.essentials.messaging;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
import com.earth2me.essentials.IEssentials;
|
||||
import com.earth2me.essentials.IUser;
|
||||
import com.earth2me.essentials.User;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
/**
|
||||
* Represents a simple reusable implementation of {@link IMessageRecipient}. This class provides functionality for the following methods:
|
||||
* <ul>
|
||||
|
@ -119,11 +119,13 @@ public class SimpleMessageRecipient implements IMessageRecipient {
|
|||
|
||||
User user = getUser(this);
|
||||
boolean afk = false;
|
||||
boolean isLastMessageReplyRecipient = ess.getSettings().isLastMessageReplyRecipient();
|
||||
if (user != null) {
|
||||
if (user.isIgnoreMsg() && sender instanceof IUser && !((IUser) sender).isAuthorized("essentials.msgtoggle.bypass")) { // Don't ignore console and senders with permission
|
||||
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();
|
||||
isLastMessageReplyRecipient = user.isLastMessageReplyRecipient();
|
||||
// Check whether this recipient ignores the sender, only if the sender is not the console.
|
||||
if (sender instanceof IUser && user.isIgnoredPlayer((IUser) sender)) {
|
||||
return MessageResponse.SENDER_IGNORED;
|
||||
|
@ -132,7 +134,7 @@ public class SimpleMessageRecipient implements IMessageRecipient {
|
|||
// Display the formatted message to this recipient.
|
||||
sendMessage(tl("msgFormat", sender.getDisplayName(), tl("me"), message));
|
||||
|
||||
if (ess.getSettings().isLastMessageReplyRecipient()) {
|
||||
if (isLastMessageReplyRecipient) {
|
||||
// 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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue