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)
{
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}")
.ToArray();
gameEvent.Origin.Tell(clientList);
gameEvent.Origin.TellAsync(clientList, gameEvent.Owner.Manager.CancellationToken);
return Task.CompletedTask;
}

View File

@ -10,7 +10,7 @@
<ItemGroup>
<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>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">

View File

@ -19,7 +19,7 @@
</PropertyGroup>
<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>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">

View File

@ -16,7 +16,7 @@
</PropertyGroup>
<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>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">

View File

@ -29,23 +29,21 @@ namespace IW4MAdmin.Plugins.Stats.Commands
_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);
if (!E.Message.IsBroadcastCommand(_config.BroadcastCommandPrefix))
if (!gameEvent.Message.IsBroadcastCommand(_config.BroadcastCommandPrefix))
{
foreach (var stat in mostKills)
{
E.Origin.Tell(stat);
}
await gameEvent.Origin.TellAsync(mostKills, gameEvent.Owner.Manager.CancellationToken);
}
else
{
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;
}
public override async Task ExecuteAsync(GameEvent E)
public override async Task ExecuteAsync(GameEvent gameEvent)
{
var topStats = await GetMostPlayed(E.Owner, _translationLookup, _contextFactory);
if (!E.Message.IsBroadcastCommand(_config.BroadcastCommandPrefix))
var topStats = await GetMostPlayed(gameEvent.Owner, _translationLookup, _contextFactory);
if (!gameEvent.Message.IsBroadcastCommand(_config.BroadcastCommandPrefix))
{
foreach (var stat in topStats)
{
E.Origin.Tell(stat);
}
await gameEvent.Origin.TellAsync(topStats, gameEvent.Owner.Manager.CancellationToken);
}
else
{
foreach (var stat in topStats)
{
E.Owner.Broadcast(stat);
}
gameEvent.Owner.Broadcast(topStats);
}
}
}

View File

@ -52,21 +52,19 @@ namespace IW4MAdmin.Plugins.Stats.Commands
_config = config;
}
public override async Task ExecuteAsync(GameEvent E)
public override async Task ExecuteAsync(GameEvent gameEvent)
{
var topStats = await GetTopStats(E.Owner, _translationLookup);
if (!E.Message.IsBroadcastCommand(_config.BroadcastCommandPrefix))
var topStats = await GetTopStats(gameEvent.Owner, _translationLookup);
if (!gameEvent.Message.IsBroadcastCommand(_config.BroadcastCommandPrefix))
{
foreach (var stat in topStats)
{
E.Origin.Tell(stat);
}
await gameEvent.Origin.TellAsync(topStats, gameEvent.Owner.Manager.CancellationToken);
}
else
{
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>
<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>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">

View File

@ -20,7 +20,7 @@
</Target>
<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>
</Project>