Softmute limits chat commands and whispers.

No more chat commands for soft-muted players.  And they may send
whispers only to other soft-muted players.
This commit is contained in:
ryanhamshire 2015-11-24 10:54:23 -08:00
parent 718c3ab407
commit 37851aacbf

View File

@ -498,7 +498,14 @@ class PlayerEventHandler implements Listener
//determine target player, might be NULL
Player targetPlayer = GriefPrevention.instance.getServer().getPlayer(args[1]);
//if eavesdrop enabled and sender doesn't have the eavesdrop permission, eavesdrop
//softmute feature
if(this.dataStore.isSoftMuted(player.getUniqueId()) && targetPlayer != null && !this.dataStore.isSoftMuted(targetPlayer.getUniqueId()))
{
event.setCancelled(true);
return;
}
//if eavesdrop enabled and sender doesn't have the eavesdrop permission, eavesdrop
if(GriefPrevention.instance.config_whisperNotifications && !player.hasPermission("griefprevention.eavesdrop"))
{
//except for when the recipient has eavesdrop permission
@ -524,8 +531,8 @@ class PlayerEventHandler implements Listener
}
}
}
//ignore feature
//ignore feature
if(targetPlayer != null && targetPlayer.isOnline())
{
//if either is ignoring the other, cancel this command
@ -555,6 +562,13 @@ class PlayerEventHandler implements Listener
return;
}
//soft mute for chat slash commands
if(category == CommandCategory.Chat && this.dataStore.isSoftMuted(player.getUniqueId()))
{
event.setCancelled(true);
return;
}
//if the slash command used is in the list of monitored commands, treat it like a chat message (see above)
boolean isMonitoredCommand = (category == CommandCategory.Chat || category == CommandCategory.Whisper);
if(isMonitoredCommand)