fix issue with multi line output freezing console

This commit is contained in:
RaidMax 2022-03-23 12:09:40 -05:00
parent 51ef67ae9c
commit 85d44b0eb0
10 changed files with 27 additions and 36 deletions

View File

@ -30,7 +30,8 @@ namespace IW4MAdmin.Application.Commands.ClientTags
if (tags is not null) if (tags is not null)
{ {
gameEvent.Origin.Tell(tags.Select(tag => tag.TagName)); await gameEvent.Origin.TellAsync(tags.Select(tag => tag.TagName),
gameEvent.Owner.Manager.CancellationToken);
} }
} }
} }

View File

@ -29,7 +29,7 @@ namespace IW4MAdmin.Application.Commands
$"[(Color::Accent){client.ClientPermission.Name}(Color::White){(string.IsNullOrEmpty(client.Tag) ? "" : $" {client.Tag}")}(Color::White)][(Color::Yellow)#{client.ClientNumber}(Color::White)] {client.Name}") $"[(Color::Accent){client.ClientPermission.Name}(Color::White){(string.IsNullOrEmpty(client.Tag) ? "" : $" {client.Tag}")}(Color::White)][(Color::Yellow)#{client.ClientNumber}(Color::White)] {client.Name}")
.ToArray(); .ToArray();
gameEvent.Origin.Tell(clientList); gameEvent.Origin.TellAsync(clientList, gameEvent.Owner.Manager.CancellationToken);
return Task.CompletedTask; return Task.CompletedTask;
} }

View File

@ -10,7 +10,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.SyndicationFeed.ReaderWriter" Version="1.0.2" /> <PackageReference Include="Microsoft.SyndicationFeed.ReaderWriter" Version="1.0.2" />
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2022.2.28.1" PrivateAssets="All" /> <PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2022.3.23.1" PrivateAssets="All" />
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">

View File

@ -19,7 +19,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2022.2.28.1" PrivateAssets="All" /> <PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2022.3.23.1" PrivateAssets="All" />
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">

View File

@ -16,7 +16,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2022.2.28.1" PrivateAssets="All" /> <PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2022.3.23.1" PrivateAssets="All" />
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">

View File

@ -29,23 +29,21 @@ namespace IW4MAdmin.Plugins.Stats.Commands
_contextFactory = contextFactory; _contextFactory = contextFactory;
} }
public override async Task ExecuteAsync(GameEvent E) public override async Task ExecuteAsync(GameEvent gameEvent)
{ {
var mostKills = await GetMostKills(StatManager.GetIdForServer(E.Owner), Plugin.Config.Configuration(), var mostKills = await GetMostKills(StatManager.GetIdForServer(gameEvent.Owner), Plugin.Config.Configuration(),
_contextFactory, _translationLookup); _contextFactory, _translationLookup);
if (!E.Message.IsBroadcastCommand(_config.BroadcastCommandPrefix)) if (!gameEvent.Message.IsBroadcastCommand(_config.BroadcastCommandPrefix))
{ {
foreach (var stat in mostKills) await gameEvent.Origin.TellAsync(mostKills, gameEvent.Owner.Manager.CancellationToken);
{
E.Origin.Tell(stat);
}
} }
else else
{ {
foreach (var stat in mostKills) foreach (var stat in mostKills)
{ {
E.Owner.Broadcast(stat); await gameEvent.Owner.Broadcast(stat).WaitAsync(Utilities.DefaultCommandTimeout,
gameEvent.Owner.Manager.CancellationToken);
} }
} }
} }

View File

@ -70,22 +70,16 @@ namespace IW4MAdmin.Plugins.Stats.Commands
_contextFactory = contextFactory; _contextFactory = contextFactory;
} }
public override async Task ExecuteAsync(GameEvent E) public override async Task ExecuteAsync(GameEvent gameEvent)
{ {
var topStats = await GetMostPlayed(E.Owner, _translationLookup, _contextFactory); var topStats = await GetMostPlayed(gameEvent.Owner, _translationLookup, _contextFactory);
if (!E.Message.IsBroadcastCommand(_config.BroadcastCommandPrefix)) if (!gameEvent.Message.IsBroadcastCommand(_config.BroadcastCommandPrefix))
{ {
foreach (var stat in topStats) await gameEvent.Origin.TellAsync(topStats, gameEvent.Owner.Manager.CancellationToken);
{
E.Origin.Tell(stat);
}
} }
else else
{ {
foreach (var stat in topStats) gameEvent.Owner.Broadcast(topStats);
{
E.Owner.Broadcast(stat);
}
} }
} }
} }

View File

@ -52,21 +52,19 @@ namespace IW4MAdmin.Plugins.Stats.Commands
_config = config; _config = config;
} }
public override async Task ExecuteAsync(GameEvent E) public override async Task ExecuteAsync(GameEvent gameEvent)
{ {
var topStats = await GetTopStats(E.Owner, _translationLookup); var topStats = await GetTopStats(gameEvent.Owner, _translationLookup);
if (!E.Message.IsBroadcastCommand(_config.BroadcastCommandPrefix)) if (!gameEvent.Message.IsBroadcastCommand(_config.BroadcastCommandPrefix))
{ {
foreach (var stat in topStats) await gameEvent.Origin.TellAsync(topStats, gameEvent.Owner.Manager.CancellationToken);
{
E.Origin.Tell(stat);
}
} }
else else
{ {
foreach (var stat in topStats) foreach (var stat in topStats)
{ {
E.Owner.Broadcast(stat); await gameEvent.Owner.Broadcast(stat).WaitAsync(Utilities.DefaultCommandTimeout,
gameEvent.Owner.Manager.CancellationToken);
} }
} }
} }

View File

@ -17,7 +17,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2022.2.28.1" PrivateAssets="All" /> <PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2022.3.23.1" PrivateAssets="All" />
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">

View File

@ -20,7 +20,7 @@
</Target> </Target>
<ItemGroup> <ItemGroup>
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2022.2.28.1" PrivateAssets="All" /> <PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2022.3.23.1" PrivateAssets="All" />
</ItemGroup> </ItemGroup>
</Project> </Project>