mirror of
https://github.com/SoDOff-Project/sodoff-mmo.git
synced 2025-10-11 08:18:49 -07:00
ManagementCommands: list and disable all chats
This commit is contained in:
parent
80b8874d50
commit
87a199fc19
@ -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();
|
||||
|
13
src/Management/Commands/DisableAllChatsCommand.cs
Normal file
13
src/Management/Commands/DisableAllChatsCommand.cs
Normal 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"));
|
||||
}
|
||||
}
|
||||
|
12
src/Management/Commands/ListAllChatOverridesCommand.cs
Normal file
12
src/Management/Commands/ListAllChatOverridesCommand.cs
Normal 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"));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user