76 lines
1.8 KiB
C#
76 lines
1.8 KiB
C#
using SharedLibraryCore;
|
|
using SharedLibraryCore.Commands;
|
|
using SharedLibraryCore.Configuration;
|
|
using SharedLibraryCore.Database.Models;
|
|
using SharedLibraryCore.Interfaces;
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
namespace ClanTagRankCommands.Commands
|
|
{
|
|
|
|
/// <summary>
|
|
/// Example script command
|
|
/// </summary>
|
|
///
|
|
|
|
public class MuteCommand : Command
|
|
{
|
|
|
|
|
|
|
|
|
|
public MuteCommand(CommandConfiguration config, ITranslationLookup lookup, IMetaService metaService, IConfigurationHandlerFactory configurationHandlerFactory) : base(config, lookup)
|
|
{
|
|
|
|
|
|
Name = "Mute";
|
|
Description = "mutes a player's chat.";
|
|
Alias = "mute";
|
|
Permission = EFClient.Permission.Administrator;
|
|
RequiresTarget = true;
|
|
Arguments = new[]
|
|
{
|
|
new CommandArgument()
|
|
{
|
|
Name = "player",
|
|
Required = true
|
|
},
|
|
new CommandArgument()
|
|
{
|
|
Name = "reason",
|
|
Required = false
|
|
}
|
|
};
|
|
}
|
|
|
|
public override async Task ExecuteAsync(GameEvent E)
|
|
{
|
|
//var S = E.Owner;
|
|
|
|
var msg = E.Data;
|
|
if (E.Data == null)
|
|
{
|
|
msg = "Muted";
|
|
}
|
|
else
|
|
{
|
|
msg = E.Data;
|
|
}
|
|
if(E.Target.IsIngame && E.Target is object && E.Target != E.Origin)
|
|
{
|
|
await E.Owner.ExecuteCommandAsync("mute_player" + " " + E.Target.ClientNumber.ToString());
|
|
E.Target.Warn("muted", E.Origin);
|
|
}
|
|
if(E.Target == E.Origin)
|
|
{
|
|
E.Origin.Tell("Can't mute yourself");
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
}
|