mirror of
https://github.com/SoDOff-Project/sodoff-mmo.git
synced 2025-10-11 08:18:49 -07:00
28 lines
1.0 KiB
C#
28 lines
1.0 KiB
C#
using sodoffmmo.Attributes;
|
|
using sodoffmmo.Core;
|
|
|
|
namespace sodoffmmo.Management.Commands;
|
|
|
|
[ManagementCommand("tempmute", Role.Moderator)]
|
|
class TempMuteCommand : IManagementCommand {
|
|
public void Handle(Client client, string[] arguments) {
|
|
if (arguments.Length < 1) {
|
|
client.Send(Utils.BuildServerSideMessage("TempMute: Invalid number of arguments", "Server"));
|
|
return;
|
|
}
|
|
string name = string.Join(' ', arguments);
|
|
Client? target = client.Room.Clients.FirstOrDefault(x => x.PlayerData.DiplayName == name);
|
|
if (target == null) {
|
|
client.Send(Utils.BuildServerSideMessage($"TempMute: user {name} not found", "Server"));
|
|
return;
|
|
}
|
|
|
|
if (target.Muted) {
|
|
client.Send(Utils.BuildServerSideMessage($"TempMute: {name} is already muted", "Server"));
|
|
} else {
|
|
target.Muted = true;
|
|
client.Send(Utils.BuildServerSideMessage($"TempMute: {name} has been temporarily muted", "Server"));
|
|
}
|
|
}
|
|
}
|