Fix async command responses (#393)

Fix logs not being written for invalid IL
This commit is contained in:
Equinox
2020-07-09 18:06:35 -07:00
committed by GitHub
parent b53194184c
commit e9e446f8ab
5 changed files with 31 additions and 11 deletions

View File

@@ -177,15 +177,11 @@ namespace Torch.Server
InsertMessage(new TorchChatMessage(TorchBase.Instance.Config.ChatName, text, TorchBase.Instance.Config.ChatColor));
_server.Invoke(() =>
{
var responses = commands.HandleCommandFromServer(text);
if (responses == null)
if (!commands.HandleCommandFromServer(text, InsertMessage))
{
InsertMessage(new TorchChatMessage(TorchBase.Instance.Config.ChatName, "Invalid command.", TorchBase.Instance.Config.ChatColor));
return;
}
foreach (var response in responses)
InsertMessage(response);
});
}
else