Skip to content

MinecraftJars.NET is a library to give .NET developers easy access for available Minecraft server version as well as Bedrock edition and Proxies.

License

Notifications You must be signed in to change notification settings

tekgator/MinecraftJars.NET

Repository files navigation

MinecraftJars.NET MinecraftJars.NET

License Language Downloads Build Releases ReleaseDate CommitDate

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 🍺)

ko-fi

Plugins

Following provider plugins are already bundled with MinecraftJars.NET:

Mojang Mojang: Vanilla, Bedrock

Paper Paper: Paper, Folia, Velocity, Waterfall

Purpur Purpur: Purpur

Pocketmine Pocketmine: Pocketmine

Mohist Mohist: Mohist

Fabric Fabric: Fabric

Spigot Spigot (Important: see details in Plugin Readme): Spigot, BungeeCord

Installing

Multiple options are available to install within your project:

  1. Install, using the Nuget Gallery

  2. Install using the Package Manager Console:

    Install-Package MinecraftJars.NET 
  3. 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 = Paper
    • IEnumerable<IMinecraftProject> = Paper, Folia, Velocity, Waterfall
      • IEnumerable<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