ManagementCommands: list and disable all chats

This commit is contained in:
Spirtix 2024-04-08 21:40:38 +02:00
parent 80b8874d50
commit 87a199fc19
3 changed files with 32 additions and 0 deletions

View File

@ -92,6 +92,13 @@ public class Room {
return rooms.Values.ToArray();
}
public static void DisableAllChatOverrides() {
lock (RoomsListLock) {
foreach (var room in rooms) {
room.Value.AllowChatOverride = false;
}
}
}
public NetworkPacket RespondJoinRoom() {
NetworkObject obj = new();

View File

@ -0,0 +1,13 @@
using sodoffmmo.Attributes;
using sodoffmmo.Core;
namespace sodoffmmo.Management.Commands;
[ManagementCommand("disableallchats", Role.Moderator)]
class DisableAllChatsCommand : IManagementCommand {
public void Handle(Client client, string[] arguments) {
Room.DisableAllChatOverrides();
client.Room.Send(Utils.BuildServerSideMessage("All chat overrides have been disabled", "Server"));
}
}

View File

@ -0,0 +1,12 @@
using sodoffmmo.Attributes;
using sodoffmmo.Core;
namespace sodoffmmo.Management.Commands;
[ManagementCommand("listallchats", Role.Moderator)]
class ListAllChatOverridesCommand : IManagementCommand {
public void Handle(Client client, string[] arguments) {
client.Send(Utils.BuildServerSideMessage(string.Join(' ', Room.AllRooms().Where(x => x.AllowChatOverride).Select(x => x.Name)), "Server"));
}
}