diff --git a/Essentials/src/main/java/com/earth2me/essentials/ISettings.java b/Essentials/src/main/java/com/earth2me/essentials/ISettings.java index 221e4a2d5..f08e3adf0 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/main/java/com/earth2me/essentials/ISettings.java @@ -59,6 +59,8 @@ public interface ISettings extends IConf { boolean getSocialSpyListenMutedPlayers(); + boolean isSocialSpyMessages(); + Set getMuteCommands(); /** diff --git a/Essentials/src/main/java/com/earth2me/essentials/Settings.java b/Essentials/src/main/java/com/earth2me/essentials/Settings.java index 9823af633..dfec0e975 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/Settings.java +++ b/Essentials/src/main/java/com/earth2me/essentials/Settings.java @@ -379,6 +379,11 @@ public class Settings implements net.ess3.api.ISettings { return config.getBoolean("socialspy-listen-muted-players", true); } + @Override + public boolean isSocialSpyMessages() { + return config.getBoolean("socialspy-messages", true); + } + private Set _getMuteCommands() { final Set muteCommands = new HashSet<>(); if (config.isList("mute-commands")) { diff --git a/Essentials/src/main/java/com/earth2me/essentials/messaging/SimpleMessageRecipient.java b/Essentials/src/main/java/com/earth2me/essentials/messaging/SimpleMessageRecipient.java index f8751a08b..4ebed9f13 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/messaging/SimpleMessageRecipient.java +++ b/Essentials/src/main/java/com/earth2me/essentials/messaging/SimpleMessageRecipient.java @@ -97,21 +97,23 @@ public class SimpleMessageRecipient implements IMessageRecipient { sendMessage(tl("msgFormat", tl("meSender"), recipient.getDisplayName(), message)); // Better Social Spy - final User senderUser = getUser(this); - final User recipientUser = getUser(recipient); - if (senderUser != null // not null if player. - // Dont spy on chats involving socialspy exempt players - && !senderUser.isAuthorized("essentials.chat.spy.exempt") - && recipientUser != null && !recipientUser.isAuthorized("essentials.chat.spy.exempt")) { - for (final User onlineUser : ess.getOnlineUsers()) { - if (onlineUser.isSocialSpyEnabled() - // Don't send socialspy messages to message sender/receiver to prevent spam - && !onlineUser.equals(senderUser) - && !onlineUser.equals(recipient)) { - if (senderUser.isMuted() && ess.getSettings().getSocialSpyListenMutedPlayers()) { - onlineUser.sendMessage(tl("socialMutedSpyPrefix") + tl("socialSpyMsgFormat", getDisplayName(), recipient.getDisplayName(), message)); - } else { - onlineUser.sendMessage(tl("socialSpyPrefix") + tl("socialSpyMsgFormat", getDisplayName(), recipient.getDisplayName(), message)); + if (ess.getSettings().isSocialSpyMessages()) { + final User senderUser = getUser(this); + final User recipientUser = getUser(recipient); + if (senderUser != null // not null if player. + // Dont spy on chats involving socialspy exempt players + && !senderUser.isAuthorized("essentials.chat.spy.exempt") + && recipientUser != null && !recipientUser.isAuthorized("essentials.chat.spy.exempt")) { + for (final User onlineUser : ess.getOnlineUsers()) { + if (onlineUser.isSocialSpyEnabled() + // Don't send socialspy messages to message sender/receiver to prevent spam + && !onlineUser.equals(senderUser) + && !onlineUser.equals(recipient)) { + if (senderUser.isMuted() && ess.getSettings().getSocialSpyListenMutedPlayers()) { + onlineUser.sendMessage(tl("socialMutedSpyPrefix") + tl("socialSpyMsgFormat", getDisplayName(), recipient.getDisplayName(), message)); + } else { + onlineUser.sendMessage(tl("socialSpyPrefix") + tl("socialSpyMsgFormat", getDisplayName(), recipient.getDisplayName(), message)); + } } } } diff --git a/Essentials/src/main/resources/config.yml b/Essentials/src/main/resources/config.yml index 505784708..cc0df88fb 100644 --- a/Essentials/src/main/resources/config.yml +++ b/Essentials/src/main/resources/config.yml @@ -201,6 +201,10 @@ socialspy-commands: # If so, they will be differentiated from those sent by normal players. socialspy-listen-muted-players: true +# Whether social spy should spy on private messages or just the commands from the list above. +# If false, social spy will only monitor commands from the list above. +socialspy-messages: true + # The following settings listen for when a player changes worlds. # If you use another plugin to control speed and flight, you should change these to false.