private void HandleVehicleDimensionChange(Element sender, Elements.Events.ElementChangedEventArgs <ushort> args) { if (sender is not Vehicle vehicle) { return; } var players = this.elementCollection.GetByType <Player>(ElementType.Player) .Where(x => x.Dimension == vehicle.Dimension); VehiclePacketFactory.CreateVehicleResyncPacket(vehicle).SendTo(players); }
private void HandlePlayerDimensionChange(Element sender, Elements.Events.ElementChangedEventArgs <ushort> args) { if (sender is not Player player) { return; } var vehicles = this.elementCollection.GetByType <Vehicle>(ElementType.Vehicle) .Where(x => x.Dimension == player.Dimension); foreach (var vehicle in vehicles) { VehiclePacketFactory.CreateVehicleResyncPacket(vehicle).SendTo(player); } }