MojSharp 1.0.0

dotnet add package MojSharp --version 1.0.0                
NuGet\Install-Package MojSharp -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MojSharp" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MojSharp --version 1.0.0                
#r "nuget: MojSharp, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MojSharp as a Cake Addin
#addin nuget:?package=MojSharp&version=1.0.0

// Install MojSharp as a Cake Tool
#tool nuget:?package=MojSharp&version=1.0.0                

Mojang Sharp

License: MIT .NET Nuget

An asynchronous Mojang API wrapper targeting .NET 7 and above.

Building

Build with dotnet:

$ dotnet build -c Release

Testing

Run all unit tests with dotnet:

$ dotnet test -c Release

Quick Start

Username → UUID

Single UUID

var response = await new UuidRequest("PotatoMaster101").Request();
Console.WriteLine($"{response.Player.Username} : {response.Player.Uuid}");

Multiple UUID

var users = new[] { "Notch", "PotatoMaster101" };
var response = await new MultiUuidRequest(users).Request();
foreach (var player in response.Players)
    Console.WriteLine($"{player.Username} : {player.Uuid}");

UUID → Profile

var response = await new ProfileRequest("cb2671d590b84dfe9b1c73683d451d1a").Request();
var texture = response.GetTextures();
Console.WriteLine($"Skin URL: {texture?.Skin?.Url}");
Console.WriteLine($"Alex Style: {texture?.Skin?.Slim}");
Console.WriteLine($"Cape URL: {texture?.CapeUrl}");

Blocked Servers

var response = await new BlockedServerRequest().Request();
Console.WriteLine(response.RawData);

Mojang Authentication

var response = await new AuthenticationRequest("username", "password").Request();
Console.WriteLine($"Client token: {response.ClientToken}");
Console.WriteLine($"Access token: {response.AccessToken}");
Console.WriteLine($"Username: {response.Profile.Username}");
Console.WriteLine($"UUID: {response.Profile.Uuid}");

Examples

Example projects can be found under examples.

TODO

  • Implement rest of API including Microsoft auth
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on MojSharp:

Package Downloads
McSkin

Small library for playing with Minecraft Skins

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 393 3/8/2023

Initial release