MinecraftJars.NET
1.4.2
See the version list below for details.
dotnet add package MinecraftJars.NET --version 1.4.2
NuGet\Install-Package MinecraftJars.NET -Version 1.4.2
<PackageReference Include="MinecraftJars.NET" Version="1.4.2" />
paket add MinecraftJars.NET --version 1.4.2
#r "nuget: MinecraftJars.NET, 1.4.2"
// Install MinecraftJars.NET as a Cake Addin #addin nuget:?package=MinecraftJars.NET&version=1.4.2 // Install MinecraftJars.NET as a Cake Tool #tool nuget:?package=MinecraftJars.NET&version=1.4.2
MinecraftJars.NET
MinecraftJars.NET is a library to give .NET developers easy access for available Minecraft server version as well as Bedrock edition and Proxies. The motivation for the library is actually a server manager I'm currently working on which will allow to download the latest and greatest Minecraft server version within the manager.
While this repository is providing already the plugins to gather the most popular Minecraft server providers and server, it is easily extendable via the MEF Framework. A developer guide will follow, but I'm pretty sure the geeks will find out themselves on how to do it.
Support
I try to be responsive to Stack Overflow questions in the minecraftjar-net
tag and issues logged on this GitHub repository.
If I've helped you and you like some of my work, feel free to buy me a coffee ☕ (or more likely a beer 🍺)
Plugins
Following provider plugins are already bundled with MinecraftJars.NET:
Mojang: Vanilla, Bedrock
Paper: Paper, Folia, Velocity, Waterfall
Purpur: Purpur
Pocketmine: Pocketmine
Mohist: Mohist
Fabric: Fabric
Spigot (Important: see details in Plugin Readme): Spigot, BungeeCord
Installing
Multiple options are available to install within your project:
Install, using the Nuget Gallery
Install using the Package Manager Console:
Install-Package MinecraftJars.NET
Install using .NET CLI
dotnet add package MinecraftJars.NET
Usage
MinecraftJars.NET comes with a MinecraftJar
class which has to be instantiated, optionally ProviderOptions
can be supplied.
Each Plugin provides an interface instance for the provider IMinecraftProvider
as well an interface instance for IEnumerable<IMinecraftProject>
with it's versions IEnumerable<IMinecraftVersion>
.
Since getting the actual download link mostly involves another API query it is accessible via the IMinecraftVersion.GetDownload()
method.
using MinecraftJars;
var minecraftJar = new MinecraftJar();
foreach (var provider in minecraftJar.GetProviders())
{
Console.WriteLine($"{provider}");
foreach (var project in provider.Projects)
{
Console.WriteLine($"\t{project}");
foreach (var version in await project.GetVersions(new VersionOptions { MaxRecords = 10 }))
{
Console.WriteLine($"\t\t{version}");
var download = await version.GetDownload();
Console.WriteLine($"\t\t\t{download}");
}
Console.WriteLine();
}
Console.WriteLine();
}
What provider / project / version information is the library providing?
To make a long story short have a look at the IMinecraftProvider
, IMinecraftProject
, IMinecraftVersion
and the IMinecraftDownload
interface to see what values are returned by default.
Each plugin could provide more information, which can be found in the README.md of the corresponding plugin.
As an example with the Paper Minecraft experience following values can be expected:
IMinecraftProvider
= PaperIEnumerable<IMinecraftProject>
= Paper, Folia, Velocity, WaterfallIEnumerable<IMinecraftVersion>
for Paper = 1.19.4, 1.19.3, 1.19.2, etc.IMinecraftDownload
= Build 123
Please note:
- If a version has multiple builds only the latest successful build will be returned via
IMinecraftVersion.GetDownload()
method. - Not all providers will fill all properties in each interface instance. Further information are provided in the README.md of each plugin.
Dependency Injection
An extensions package is available for Dependency Injection. Look up the project but it is as easy as installing it and adding MinecraftJar.NET to the DI.
Demo application
Have a look at the Console Demo within the repository. It will run straight out of the box to give you a hint what the library can do for you.
Dependencies and Credits
Teneko's Teronis.DotNet for allowing project reference content to be added to the NuGet package during pack process
Icons are provided by Flat Icons
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- Microsoft.Extensions.Http (>= 7.0.0)
- System.ComponentModel.Composition (>= 7.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on MinecraftJars.NET:
Package | Downloads |
---|---|
MinecraftJars.NET.Extensions.DependencyInjection
Dependency injection extension for MinecraftJars.NET |
GitHub repositories
This package is not used by any popular GitHub repositories.
# Changelog
All notable changes to this project will be documented in this file.
## [Unreleased]
## [1.4.2] - 2023-06-03
### Removed
- Removed ProviderOptions as it had no use and created an unnecessary dependency
### Added
- Added MinecraftJarOptions so the optional IHttpClientFactory can be provided
### Fixed
- Removed unnecessary dependency of MinecraftJars.Core causing Nuget installation to fail
## [1.4.1] - 2023-06-03
### Changed
- Renamed MinecraftJarManager to MinecraftJar
### Added
- IMinecraftJar interface
- Extension for dependency injection
- Test case for dependency injection
- Automatic deployment of dependency injection injection to nuget.org
## [1.3.2] - 2023-06-01
### Added
- Fabric version snapshot test missing
### Fixed
- Fabric returned only snapshots with the new IsSnapshot flag
## [1.3.1] - 2023-06-01
### Fixed
- All plugin share the same (static) HttpClient now if HttpClientFactory is not provided, preventing Socket exhaustion
## [1.3.0] - 2023-06-01
### Added
- Paper plugin flag pre and snapshot builds as IsSnapshot
- Pocketmine flag alpha builds as IsSnapshot
- Spigot plugin flag pre and snapshot builds as IsSnapshot
### Changed
- Renamed IProvider to IMinecraftProvider
- Renamed IProject to IMinecraftProject
- Renamed IVersion to IMinecraftVersion
- Renamed IDownload to IMinecraftDownload
- Rename ProviderManager to MinecraftProviderManager
- Change LINQ method calls to query format
## [1.2.3] - 2023-05-31
### Changed
- GetVersion on IProvider now returns all versions for all projects
### Added
- GetVersion on IProject returns all versions for that project
## [1.2.2] - 2023-05-30
### Added
- Add version option to include snapshots during load, by default this is false
- Add indicator to show that the current version is a snapshot / preview / experimental / beta / alpha build
- Add IsSnapshot test cases
### Changed
- Restructure and simplify API directories
### Removed
- Separation of Snapshot ans Standard versions for Mojang, Fabric and Pocketmine plugin, this is handled now via the IsSnapshot indicator on IVersion
## [1.2.1] - 2023-05-29
### Fixed
- Nuget release process
## [1.2.0] - 2023-05-29
### Added
- Add logos in different sizes for fixing Readme on Nuget.org
- Add Fabric Provider Plugin
### Fixed
- Fix logos and links in Readme
### Changed
- Renamed Mohist project from MohistMC to Mohist
## [1.1.0] - 2023-05-29
### Added
- Add Pocketmine Provider Plugin
- Add logos to each Readme
## [1.0.0] - 2023-05-28
### Fixed
- In case of Task cancellation for a Spigot build make sure the whole process tree is killed
- Website (Mojang, Spigot) did not respond because AcceptEncoding has to be provided. Always add AcceptEncoding identity
### Changed
- Normalize names of Plugins e.g. SpigotMC is now just Spigot
- Created temp folders during Spigot build include the Plugin name for easier identification
### Added
- First working version
- Unit testing project added
- Add comment for old versions not proving Url due to missing server in Mojang Plugin Readme
- Implement version filter in Spigot version factory
- For Website crawling (Mojang, Spigot) add AcceptLanguage en-US, en to make sure content is not changed due to change of language
- For Website crawling (Mojang, Spigot) add CacheControl with NoCache to get latest version of the website
## [0.1.0] - 2023-05-28
### Added
- First working version
This project is MIT Licensed // Created & maintained by Patrick Weiss