server-master/srcs/_plugins/Plugin.TimeSpaces/Handlers/TimeSpaceRemoveItemsEventHandler.cs
2026-02-10 18:21:30 +01:00

26 lines
No EOL
743 B
C#

using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using PhoenixLib.Events;
using WingsEmu.Game.Extensions;
using WingsEmu.Game.Maps;
using WingsEmu.Game.TimeSpaces.Events;
namespace Plugin.TimeSpaces.Handlers;
public class TimeSpaceRemoveItemsEventHandler : IAsyncEventProcessor<TimeSpaceRemoveItemsEvent>
{
public async Task HandleAsync(TimeSpaceRemoveItemsEvent e, CancellationToken cancellation)
{
IEnumerable<TimeSpaceMapItem> items = e.ItemsToRemove;
foreach (TimeSpaceMapItem item in items)
{
if (!item.MapInstance.RemoveDrop(item.TransportId))
{
continue;
}
item.BroadcastOut();
}
}
}