Skip to content

Commit c944a06

Browse files
committed
Removed ProviderOptions as it had no use and created an unnecessary dependency
1 parent d6032c1 commit c944a06

File tree

13 files changed

+26
-53
lines changed

13 files changed

+26
-53
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file.
33

44
## [Unreleased]
55

6+
## [1.4.2] - 2023-06-03
7+
8+
### Removed
9+
- Removed ProviderOptions as it had no use and created an unnecessary dependency
10+
11+
### Added
12+
- Added MinecraftJarOptions so the optional IHttpClientFactory can be provided
13+
14+
### Fixed
15+
- Removed unnecessary dependency of MinecraftJars.Core causing Nuget installation to fail
16+
17+
618
## [1.4.1] - 2023-06-03
719

820
### Changed

MinecraftJars.Core/Providers/IMinecraftProvider.cs

-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ namespace MinecraftJars.Core.Providers;
55

66
public interface IMinecraftProvider
77
{
8-
/// <summary>
9-
/// The options the provider manager has been provided with
10-
/// </summary>
11-
ProviderOptions ProviderOptions { get; }
12-
138
/// <summary>
149
/// Name of the provider e.g. Mojang, PaperMC, etc.
1510
/// </summary>

MinecraftJars.Extension/MinecraftJars.Extension.DependencyInjection/MinecraftJars.Extension.DependencyInjection.csproj

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
</ItemGroup>
2525

2626
<ItemGroup>
27-
<ProjectReference Include="..\..\MinecraftJars.Core\MinecraftJars.Core.csproj" />
2827
<ProjectReference Include="..\..\MinecraftJars\MinecraftJars.csproj" />
2928
</ItemGroup>
3029

MinecraftJars.Extension/MinecraftJars.Extension.DependencyInjection/ServiceCollectionExtensions.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Microsoft.Extensions.DependencyInjection;
2-
using MinecraftJars.Core.Providers;
32

43
namespace MinecraftJars.Extension.DependencyInjection;
54

@@ -8,7 +7,7 @@ public static class ServiceCollectionExtensions
87
public static IServiceCollection AddMinecraftJar(this IServiceCollection services)
98
{
109
services.AddHttpClient();
11-
services.AddScoped<IMinecraftJar, MinecraftJar>(sp => new MinecraftJar(new ProviderOptions
10+
services.AddScoped<IMinecraftJar, MinecraftJar>(sp => new MinecraftJar(new MinecraftJarOptions()
1211
{
1312
HttpClientFactory = sp.GetRequiredService<IHttpClientFactory>()
1413
}));

MinecraftJars.Plugin/MinecraftJars.Plugin.Fabric/FabricProvider.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@ namespace MinecraftJars.Plugin.Fabric;
1010
public class FabricProvider : IMinecraftProvider
1111
{
1212
[ImportingConstructor]
13-
public FabricProvider(
14-
PluginHttpClientFactory httpClientFactory,
15-
ProviderOptions? options)
13+
public FabricProvider(PluginHttpClientFactory httpClientFactory)
1614
{
1715
FabricVersionFactory.HttpClientFactory = httpClientFactory;
18-
ProviderOptions = options ?? new ProviderOptions();
1916
}
2017

21-
public ProviderOptions ProviderOptions { get; }
2218
public string Name => "Fabric";
2319
public byte[] Logo => Properties.Resources.Fabric;
2420
public IEnumerable<IMinecraftProject> Projects => FabricProjectFactory.Projects;

MinecraftJars.Plugin/MinecraftJars.Plugin.Mohist/MohistProvider.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@ namespace MinecraftJars.Plugin.Mohist;
1010
public class MohistProvider : IMinecraftProvider
1111
{
1212
[ImportingConstructor]
13-
public MohistProvider(
14-
PluginHttpClientFactory httpClientFactory,
15-
ProviderOptions? options)
13+
public MohistProvider(PluginHttpClientFactory httpClientFactory)
1614
{
1715
MohistVersionFactory.HttpClientFactory = httpClientFactory;
18-
ProviderOptions = options ?? new ProviderOptions();
1916
}
2017

21-
public ProviderOptions ProviderOptions { get; }
2218
public string Name => "Mohist";
2319
public byte[] Logo => Properties.Resources.Mohist;
2420
public IEnumerable<IMinecraftProject> Projects => MohistProjectFactory.Projects;

MinecraftJars.Plugin/MinecraftJars.Plugin.Mojang/MojangProvider.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@ namespace MinecraftJars.Plugin.Mojang;
1010
public class MojangProvider : IMinecraftProvider
1111
{
1212
[ImportingConstructor]
13-
public MojangProvider(
14-
PluginHttpClientFactory httpClientFactory,
15-
ProviderOptions? options)
13+
public MojangProvider(PluginHttpClientFactory httpClientFactory)
1614
{
1715
MojangVersionFactory.HttpClientFactory = httpClientFactory;
18-
ProviderOptions = options ?? new ProviderOptions();
1916
}
2017

21-
public ProviderOptions ProviderOptions { get; }
2218
public string Name => "Mojang";
2319
public byte[] Logo => Properties.Resources.Mojang;
2420
public IEnumerable<IMinecraftProject> Projects => MojangProjectFactory.Projects;

MinecraftJars.Plugin/MinecraftJars.Plugin.Paper/PaperProvider.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@ namespace MinecraftJars.Plugin.Paper;
1010
public class PaperProvider : IMinecraftProvider
1111
{
1212
[ImportingConstructor]
13-
public PaperProvider(
14-
PluginHttpClientFactory httpClientFactory,
15-
ProviderOptions? options)
13+
public PaperProvider(PluginHttpClientFactory httpClientFactory)
1614
{
1715
PaperVersionFactory.HttpClientFactory = httpClientFactory;
18-
ProviderOptions = options ?? new ProviderOptions();
1916
}
2017

21-
public ProviderOptions ProviderOptions { get; }
2218
public string Name => "Paper";
2319
public byte[] Logo => Properties.Resources.Paper;
2420
public IEnumerable<IMinecraftProject> Projects => PaperProjectFactory.Projects;

MinecraftJars.Plugin/MinecraftJars.Plugin.Pocketmine/PocketmineProvider.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@ namespace MinecraftJars.Plugin.Pocketmine;
1010
public class PocketmineProvider : IMinecraftProvider
1111
{
1212
[ImportingConstructor]
13-
public PocketmineProvider(
14-
PluginHttpClientFactory httpClientFactory,
15-
ProviderOptions? options)
13+
public PocketmineProvider(PluginHttpClientFactory httpClientFactory)
1614
{
1715
PocketmineVersionFactory.HttpClientFactory = httpClientFactory;
18-
ProviderOptions = options ?? new ProviderOptions();
1916
}
2017

21-
public ProviderOptions ProviderOptions { get; }
2218
public string Name => "Pocketmine";
2319
public byte[] Logo => Properties.Resources.Pocketmine;
2420
public IEnumerable<IMinecraftProject> Projects => PocketmineProjectFactory.Projects;

MinecraftJars.Plugin/MinecraftJars.Plugin.Purpur/PurpurProvider.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@ namespace MinecraftJars.Plugin.Purpur;
1010
public class PurpurProvider : IMinecraftProvider
1111
{
1212
[ImportingConstructor]
13-
public PurpurProvider(
14-
PluginHttpClientFactory httpClientFactory,
15-
ProviderOptions? options)
13+
public PurpurProvider(PluginHttpClientFactory httpClientFactory)
1614
{
1715
PurpurVersionFactory.HttpClientFactory = httpClientFactory;
18-
ProviderOptions = options ?? new ProviderOptions();
1916
}
2017

21-
public ProviderOptions ProviderOptions { get; }
2218
public string Name => "Purpur";
2319
public byte[] Logo => Properties.Resources.Purpur;
2420
public IEnumerable<IMinecraftProject> Projects => PurpurProjectFactory.Projects;

MinecraftJars.Plugin/MinecraftJars.Plugin.Spigot/SpigotProvider.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@ namespace MinecraftJars.Plugin.Spigot;
1010
public class SpigotProvider : IMinecraftProvider
1111
{
1212
[ImportingConstructor]
13-
public SpigotProvider(
14-
PluginHttpClientFactory httpClientFactory,
15-
ProviderOptions? options)
13+
public SpigotProvider(PluginHttpClientFactory httpClientFactory)
1614
{
1715
SpigotVersionFactory.HttpClientFactory = httpClientFactory;
18-
ProviderOptions = options ?? new ProviderOptions();
1916
}
2017

21-
public ProviderOptions ProviderOptions { get; }
2218
public string Name => "Spigot";
2319
public byte[] Logo => Properties.Resources.Spigot;
2420
public IEnumerable<IMinecraftProject> Projects => SpigotProjectFactory.Projects;

MinecraftJars/MinecraftJar.cs

+3-7
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,12 @@ public class MinecraftJar : IMinecraftJar
1212
[ImportMany(typeof(IMinecraftProvider))]
1313
private IEnumerable<IMinecraftProvider> _providers;
1414

15-
[Export]
16-
private ProviderOptions ProviderOptions { get; }
17-
1815
[Export]
1916
private PluginHttpClientFactory HttpClientFactory { get; }
20-
21-
public MinecraftJar(ProviderOptions? options = null)
17+
18+
public MinecraftJar(MinecraftJarOptions? options = null)
2219
{
23-
ProviderOptions = options ?? new ProviderOptions();
24-
HttpClientFactory = new PluginHttpClientFactory(ProviderOptions.HttpClientFactory);
20+
HttpClientFactory = new PluginHttpClientFactory(options?.HttpClientFactory);
2521

2622
var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? ".";
2723
var catalog = new AggregateCatalog();
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
namespace MinecraftJars.Core.Providers;
1+
namespace MinecraftJars;
22

3-
public class ProviderOptions
3+
public class MinecraftJarOptions
44
{
55
/// <summary>
66
/// If provided the CreateClient Method is utilized to create a HttpClient
77
/// otherwise a new HttpClient is instantiated by the MinecraftJarManager
88
/// </summary>
9-
public IHttpClientFactory? HttpClientFactory { get; init; }
9+
public IHttpClientFactory? HttpClientFactory { get; init; }
1010
}

0 commit comments

Comments
 (0)