mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 15:20:48 -05:00
Fix self-targeting
Remove creation of penalty on mute expiration
This commit is contained in:
@ -34,6 +34,12 @@ public class MuteCommand : Command
|
||||
|
||||
public override async Task ExecuteAsync(GameEvent gameEvent)
|
||||
{
|
||||
if (gameEvent.Origin.ClientId == gameEvent.Target.ClientId)
|
||||
{
|
||||
gameEvent.Origin.Tell(_translationLookup["PLUGINS_MUTE_SELF_TARGET"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (await Plugin.MuteManager.Mute(gameEvent.Owner, gameEvent.Origin, gameEvent.Target, null, gameEvent.Data))
|
||||
{
|
||||
gameEvent.Origin.Tell(_translationLookup["PLUGINS_MUTE_COMMANDS_MUTE_MUTED"]
|
||||
|
@ -42,6 +42,12 @@ public class TempMuteCommand : Command
|
||||
|
||||
public override async Task ExecuteAsync(GameEvent gameEvent)
|
||||
{
|
||||
if (gameEvent.Origin.ClientId == gameEvent.Target.ClientId)
|
||||
{
|
||||
gameEvent.Origin.Tell(_translationLookup["PLUGINS_MUTE_SELF_TARGET"]);
|
||||
return;
|
||||
}
|
||||
|
||||
var match = Regex.Match(gameEvent.Data, TempBanRegex);
|
||||
if (match.Success)
|
||||
{
|
||||
|
@ -34,6 +34,12 @@ public class UnmuteCommand : Command
|
||||
|
||||
public override async Task ExecuteAsync(GameEvent gameEvent)
|
||||
{
|
||||
if (gameEvent.Origin.ClientId == gameEvent.Target.ClientId)
|
||||
{
|
||||
gameEvent.Origin.Tell(_translationLookup["PLUGINS_MUTE_SELF_TARGET"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (await Plugin.MuteManager.Unmute(gameEvent.Owner, gameEvent.Origin, gameEvent.Target, gameEvent.Data))
|
||||
{
|
||||
gameEvent.Origin.Tell(_translationLookup["PLUGINS_MUTE_COMMANDS_UNMUTE_UNMUTED"]
|
||||
|
@ -98,7 +98,7 @@ public class MuteManager
|
||||
if (clientMuteMeta.MuteState is MuteState.Unmuted && clientMuteMeta.CommandExecuted) return false;
|
||||
if (!target.IsIngame && clientMuteMeta.MuteState is MuteState.Unmuting) return false;
|
||||
|
||||
if (clientMuteMeta.MuteState is not MuteState.Unmuting)
|
||||
if (clientMuteMeta.MuteState is not MuteState.Unmuting || origin.ClientId != 1)
|
||||
{
|
||||
await CreatePenalty(MuteState.Unmuted, origin, target, DateTime.UtcNow, reason);
|
||||
}
|
||||
|
Reference in New Issue
Block a user