-
Notifications
You must be signed in to change notification settings - Fork 0
/
PaperProvider.cs
36 lines (30 loc) · 1.1 KB
/
PaperProvider.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.ComponentModel.Composition;
using MinecraftJars.Core;
using MinecraftJars.Core.Projects;
using MinecraftJars.Core.Providers;
using MinecraftJars.Core.Versions;
namespace MinecraftJars.Plugin.Paper;
[Export(typeof(IMinecraftProvider))]
public class PaperProvider : IMinecraftProvider
{
[ImportingConstructor]
public PaperProvider(PluginHttpClientFactory httpClientFactory)
{
PaperVersionFactory.HttpClientFactory = httpClientFactory;
}
public string Name => "Paper";
public byte[] Logo => Properties.Resources.Paper;
public IEnumerable<IMinecraftProject> Projects => PaperProjectFactory.Projects;
public async Task<IEnumerable<IMinecraftVersion>> GetVersions(
VersionOptions? options = null,
CancellationToken cancellationToken = default)
{
var versionOptions = options ?? new VersionOptions();
var versions = new List<IMinecraftVersion>();
foreach (var project in Projects)
{
versions.AddRange(await project.GetVersions(versionOptions, cancellationToken));
}
return versions;
}
}