Don't socialspy broadcast raw /msg and /r.

This commit is contained in:
Ali Moghnieh 2016-07-23 00:09:18 +01:00
parent 87adbb477d
commit c4c303dbfb
No known key found for this signature in database
GPG key ID: F09D3A1BAF2E6D70

View file

@ -384,12 +384,18 @@ public class EssentialsPlayerListener implements Listener {
LOGGER.info(tl("mutedUserSpeaks", player.getName())); LOGGER.info(tl("mutedUserSpeaks", player.getName()));
return; return;
} }
PluginCommand pluginCommand = ess.getServer().getPluginCommand(cmd);
if (ess.getSettings().getSocialSpyCommands().contains(cmd) || ess.getSettings().getSocialSpyCommands().contains("*")) { if (ess.getSettings().getSocialSpyCommands().contains(cmd) || ess.getSettings().getSocialSpyCommands().contains("*")) {
User user = ess.getUser(player); if (pluginCommand == null
if (!user.isAuthorized("essentials.chat.spy.exempt")) { || (!pluginCommand.getName().equals("msg") && !pluginCommand.getName().equals("r"))) { // /msg and /r are handled in SimpleMessageRecipient
for (User spyer : ess.getOnlineUsers()) { User user = ess.getUser(player);
if (spyer.isSocialSpyEnabled() && !player.equals(spyer.getBase())) { if (!user.isAuthorized("essentials.chat.spy.exempt")) {
spyer.sendMessage(player.getDisplayName() + " : " + event.getMessage()); for (User spyer : ess.getOnlineUsers()) {
if (spyer.isSocialSpyEnabled() && !player.equals(spyer.getBase())) {
spyer.sendMessage(player.getDisplayName() + " : " + event.getMessage());
}
} }
} }
} }
@ -398,7 +404,6 @@ public class EssentialsPlayerListener implements Listener {
boolean broadcast = true; // whether to broadcast the updated activity boolean broadcast = true; // whether to broadcast the updated activity
boolean update = true; // Only modified when the command is afk boolean update = true; // Only modified when the command is afk
PluginCommand pluginCommand = ess.getServer().getPluginCommand(cmd);
if (pluginCommand != null) { if (pluginCommand != null) {
// Switch case for commands that shouldn't broadcast afk activity. // Switch case for commands that shouldn't broadcast afk activity.
switch (pluginCommand.getName()) { switch (pluginCommand.getName()) {