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:
parent
718c3ab407
commit
37851aacbf
|
|
@ -498,7 +498,14 @@ class PlayerEventHandler implements Listener
|
||||||
//determine target player, might be NULL
|
//determine target player, might be NULL
|
||||||
Player targetPlayer = GriefPrevention.instance.getServer().getPlayer(args[1]);
|
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"))
|
if(GriefPrevention.instance.config_whisperNotifications && !player.hasPermission("griefprevention.eavesdrop"))
|
||||||
{
|
{
|
||||||
//except for when the recipient has eavesdrop permission
|
//except for when the recipient has eavesdrop permission
|
||||||
|
|
@ -525,7 +532,7 @@ class PlayerEventHandler implements Listener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//ignore feature
|
//ignore feature
|
||||||
if(targetPlayer != null && targetPlayer.isOnline())
|
if(targetPlayer != null && targetPlayer.isOnline())
|
||||||
{
|
{
|
||||||
//if either is ignoring the other, cancel this command
|
//if either is ignoring the other, cancel this command
|
||||||
|
|
@ -555,6 +562,13 @@ class PlayerEventHandler implements Listener
|
||||||
return;
|
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)
|
//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);
|
boolean isMonitoredCommand = (category == CommandCategory.Chat || category == CommandCategory.Whisper);
|
||||||
if(isMonitoredCommand)
|
if(isMonitoredCommand)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user