mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-05 12:02:53 +00:00
Add config option to disable message social spy (#3910)
Adds a config option to allow to prevent socialspy from reading private messages. Useful if all you want from social spy is to read commands defined in the list. Closes #1095.
This commit is contained in:
parent
cb168b0c8a
commit
500edb7860
4 changed files with 28 additions and 15 deletions
|
@ -59,6 +59,8 @@ public interface ISettings extends IConf {
|
||||||
|
|
||||||
boolean getSocialSpyListenMutedPlayers();
|
boolean getSocialSpyListenMutedPlayers();
|
||||||
|
|
||||||
|
boolean isSocialSpyMessages();
|
||||||
|
|
||||||
Set<String> getMuteCommands();
|
Set<String> getMuteCommands();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -379,6 +379,11 @@ public class Settings implements net.ess3.api.ISettings {
|
||||||
return config.getBoolean("socialspy-listen-muted-players", true);
|
return config.getBoolean("socialspy-listen-muted-players", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSocialSpyMessages() {
|
||||||
|
return config.getBoolean("socialspy-messages", true);
|
||||||
|
}
|
||||||
|
|
||||||
private Set<String> _getMuteCommands() {
|
private Set<String> _getMuteCommands() {
|
||||||
final Set<String> muteCommands = new HashSet<>();
|
final Set<String> muteCommands = new HashSet<>();
|
||||||
if (config.isList("mute-commands")) {
|
if (config.isList("mute-commands")) {
|
||||||
|
|
|
@ -97,6 +97,7 @@ public class SimpleMessageRecipient implements IMessageRecipient {
|
||||||
sendMessage(tl("msgFormat", tl("meSender"), recipient.getDisplayName(), message));
|
sendMessage(tl("msgFormat", tl("meSender"), recipient.getDisplayName(), message));
|
||||||
|
|
||||||
// Better Social Spy
|
// Better Social Spy
|
||||||
|
if (ess.getSettings().isSocialSpyMessages()) {
|
||||||
final User senderUser = getUser(this);
|
final User senderUser = getUser(this);
|
||||||
final User recipientUser = getUser(recipient);
|
final User recipientUser = getUser(recipient);
|
||||||
if (senderUser != null // not null if player.
|
if (senderUser != null // not null if player.
|
||||||
|
@ -116,6 +117,7 @@ public class SimpleMessageRecipient implements IMessageRecipient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// If the message was a success, set this sender's reply-recipient to the current recipient.
|
// If the message was a success, set this sender's reply-recipient to the current recipient.
|
||||||
|
|
|
@ -201,6 +201,10 @@ socialspy-commands:
|
||||||
# If so, they will be differentiated from those sent by normal players.
|
# If so, they will be differentiated from those sent by normal players.
|
||||||
socialspy-listen-muted-players: true
|
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.
|
# 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.
|
# If you use another plugin to control speed and flight, you should change these to false.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue