server-master/srcs/_plugins/WingsEmu.Plugins.GameEvents/Consumers/InstantBattleStartMessageConsumer.cs
2026-02-10 18:21:30 +01:00

29 lines
No EOL
930 B
C#

// WingsEmu
//
// Developed by NosWings Team
using System.Threading;
using System.Threading.Tasks;
using PhoenixLib.Events;
using PhoenixLib.ServiceBus;
using WingsAPI.Communication.InstantBattle;
using WingsEmu.Game.GameEvent;
using WingsEmu.Plugins.GameEvents.Event.Global;
namespace WingsEmu.Plugins.GameEvents.Consumers
{
public class InstantBattleStartMessageConsumer : IMessageConsumer<InstantBattleStartMessage>
{
private readonly IAsyncEventPipeline _eventPipeline;
public InstantBattleStartMessageConsumer(IAsyncEventPipeline eventPipeline) => _eventPipeline = eventPipeline;
public async Task HandleAsync(InstantBattleStartMessage notification, CancellationToken token)
{
await _eventPipeline.ProcessEventAsync(new GameEventPrepareEvent(GameEventType.InstantBattle)
{
NoDelay = notification.HasNoDelay
});
}
}
}