-
Notifications
You must be signed in to change notification settings - Fork 0
/
PocketmineProvider.cs
36 lines (30 loc) · 1.14 KB
/
PocketmineProvider.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.Pocketmine;
[Export(typeof(IMinecraftProvider))]
public class PocketmineProvider : IMinecraftProvider
{
[ImportingConstructor]
public PocketmineProvider(PluginHttpClientFactory httpClientFactory)
{
PocketmineVersionFactory.HttpClientFactory = httpClientFactory;
}
public string Name => "Pocketmine";
public byte[] Logo => Properties.Resources.Pocketmine;
public IEnumerable<IMinecraftProject> Projects => PocketmineProjectFactory.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;
}
}