Added command handler for room elapsed time. (#12)

* Added command handler for room elapsed time.
* Made ElapsedTimeSyncHandler use Runtime.CurrentRuntime instead of creating a stopwatch per-room.
This commit is contained in:
Hipposgrumm 2025-12-07 11:33:24 -07:00 committed by GitHub
parent a94e5f75e0
commit 0c8d57f03d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,20 @@
using sodoffmmo.Attributes;
using sodoffmmo.Core;
using sodoffmmo.Data;
namespace sodoffmmo.CommandHandlers;
[ExtensionCommandHandler("RTM")]
class ElapsedTimeSyncHandler : CommandHandler {
public override Task Handle(Client client, NetworkObject receivedObject) {
if (client.Room != null) {
NetworkObject cmd = new();
NetworkObject obj = new();
obj.Add("arr", new string[] { "RTM", "-1", Runtime.CurrentRuntime.ToString() });
cmd.Add("c", "RTM");
cmd.Add("p", obj);
client.Send(NetworkObject.WrapObject(1, 13, cmd).Serialize());
}
return Task.CompletedTask;
}
}