diff --git a/SlipeServer.Hosting/HostedMtaServer.cs b/SlipeServer.Hosting/HostedMtaServer.cs deleted file mode 100644 index 8ee1079d..00000000 --- a/SlipeServer.Hosting/HostedMtaServer.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace SlipeServer.Hosting; - -public class HostedMtaServer(MtaServer server) -{ - public MtaServer Server { get; } = server; - - public void Start() => this.Server.Start(); - - public void Stop() => this.Server.Stop(); -} diff --git a/SlipeServer.Hosting/MtaServerHostedService.cs b/SlipeServer.Hosting/MtaServerHostedService.cs index b4f6fa95..3d2862c8 100644 --- a/SlipeServer.Hosting/MtaServerHostedService.cs +++ b/SlipeServer.Hosting/MtaServerHostedService.cs @@ -1,6 +1,6 @@ namespace SlipeServer.Hosting; -public class MtaServerHostedService : IHostedService where T : MtaServer +public class MtaServerHostedService : IHostedLifecycleService where T : MtaServer { private readonly T server; @@ -8,17 +8,37 @@ public MtaServerHostedService(T server) { this.server = server; - server.BuildFinalizer?.Invoke(); + this.server.BuildFinalizer?.Invoke(); } public Task StartAsync(CancellationToken cancellationToken) + { + return Task.CompletedTask; + } + + public Task StartedAsync(CancellationToken cancellationToken) { this.server.Start(); return Task.CompletedTask; } + public Task StartingAsync(CancellationToken cancellationToken) + { + return Task.CompletedTask; + } + public Task StopAsync(CancellationToken cancellationToken) + { + return Task.CompletedTask; + } + + public Task StoppedAsync(CancellationToken cancellationToken) + { + return Task.CompletedTask; + } + + public Task StoppingAsync(CancellationToken cancellationToken) { this.server.Stop();