Add permission to bypass other's msgtoggle (#1955) @Xeyame

* Add permission to bypass other's msgtoggle

Also thanks to MD for helping me with the code :)

* Correct comment

* Remove checking for console in favour of the already existing IUser check

* Fix comments, again

* Re add isIgnoreMsg() check

Accidently removed it, sorry

* Combine 2 checks
This commit is contained in:
Xeyame 2018-05-26 21:43:31 +02:00 committed by md678685
parent 817caf299f
commit 7298393ec9

View File

@ -121,9 +121,8 @@ public class SimpleMessageRecipient implements IMessageRecipient {
User user = getUser(this); User user = getUser(this);
boolean afk = false; boolean afk = false;
if (user != null) { if (user != null) {
if (user.isIgnoreMsg() if (user.isIgnoreMsg() && sender instanceof IUser && !((IUser) sender).isAuthorized("essentials.msgtoggle.bypass")) { // Don't ignore console and senders with permission
&& !(sender instanceof Console)) { // Console must never be ignored. return MessageResponse.MESSAGES_IGNORED;
return MessageResponse.MESSAGES_IGNORED;
} }
afk = user.isAfk(); afk = user.isAfk();
// Check whether this recipient ignores the sender, only if the sender is not the console. // Check whether this recipient ignores the sender, only if the sender is not the console.