From e17d4e0e0eee227378a73ece3ce10f70f0fe89d2 Mon Sep 17 00:00:00 2001 From: Starlk Date: Thu, 8 Feb 2024 02:51:18 +0300 Subject: [PATCH] Server closed message (#421) * Should fix #251 * Fixes #418 * Update Server.cs * Disconnect players with a "Server closed" message when closing the server --- Obsidian/Server.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Obsidian/Server.cs b/Obsidian/Server.cs index a7e72fe39..070f88ef3 100644 --- a/Obsidian/Server.cs +++ b/Obsidian/Server.cs @@ -561,6 +561,11 @@ await player.SendSoundAsync(SoundEffectBuilder.Create(SoundId.EntitySheepAmbient // Just stop looping. } + foreach (var client in _clients) + { + client.SendPacket(new DisconnectPacket(ChatMessage.Simple("Server closed"), client.State)); + } + _logger.LogInformation("The game loop has been stopped"); await WorldManager.FlushLoadedWorldsAsync(); }