From e08e0eaf64791676040ed2784cea773ce70d7f36 Mon Sep 17 00:00:00 2001 From: "starlkytminecraft@gmail.com" Date: Mon, 22 Jan 2024 01:14:21 +0300 Subject: [PATCH 1/2] Should fix #251 --- Obsidian/Commands/Framework/Entities/Command.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Obsidian/Commands/Framework/Entities/Command.cs b/Obsidian/Commands/Framework/Entities/Command.cs index b3788e10b..96fbaf754 100644 --- a/Obsidian/Commands/Framework/Entities/Command.cs +++ b/Obsidian/Commands/Framework/Entities/Command.cs @@ -106,8 +106,9 @@ public async Task ExecuteAsync(CommandContext context, string[] args) { // Current param and arg var paraminfo = methodparams[i]; - var arg = args[i]; + var arg = args.Length > 0 ? args[i] : string.Empty; + // This can only be true if we get a [Remaining] arg. Sets arg to remaining text. if (args.Length > methodparams.Length && i == methodparams.Length - 1) { From 0003f9566c70359cb3acd6dff9cfeb0ff4607aaf Mon Sep 17 00:00:00 2001 From: "starlkytminecraft@gmail.com" Date: Mon, 22 Jan 2024 01:27:23 +0300 Subject: [PATCH 2/2] Fixes #418 --- Obsidian/Server.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Obsidian/Server.cs b/Obsidian/Server.cs index e3b277ac6..ef6379598 100644 --- a/Obsidian/Server.cs +++ b/Obsidian/Server.cs @@ -67,6 +67,7 @@ public static string VERSION private readonly ILogger _logger; private IConnectionListener? _tcpListener; + private bool _isFullyInitialized; public ProtocolVersion Protocol => DefaultProtocol; @@ -289,6 +290,7 @@ public async Task RunAsync() continue; _logger.LogInformation("Listening for new clients..."); + _isFullyInitialized = true; try { @@ -331,8 +333,17 @@ private async Task AcceptClientsAsync() // No longer accepting clients. break; } - connection = acceptedConnection; + + if (!_isFullyInitialized) + { + connection.Abort(); + await connection.DisposeAsync(); + + _logger.LogDebug("Server has not been fully initialized. Aborted the connection"); + continue; + } + } catch (OperationCanceledException) {