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.
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 🍺)
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
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
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();
}
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.
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.
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.
-
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