Deprecation notice: This project will be archived once PotatoMaster101/MojSharp is completed.
An asynchronous Mojang API wrapper in C# targeting .NET 5
and above.
Build with dotnet
:
$ dotnet build -c Release
Run unit tests on local PC:
$ dotnet test -c Release
Run unit tests in docker:
$ docker build -t mojapi .
var auth = await new AuthenticationEndpoint(new Credentials("username", "password")).Request();
Console.WriteLine(auth.Token.AccessToken);
Console.WriteLine(auth.Token.ClientToken);
var player = await new SingleUuidEndpoint("player").Request();
var history = await new NameHistoryEndpoint(player.Player.Uuid).Request();
foreach (var (name, timestamp) in history.History)
Console.WriteLine($"{name}, {timestamp}");
var player = await new SingleUuidEndpoint("player").Request();
var profile = await new ProfileEndpoint(player.Player.Uuid).Request();
Console.WriteLine(profile.Texture.SkinUrl);
Change skin to a local file:
var skin = new Skin("some/minecraft/skin.png", Skin.SlimStyle); // or Skin.ClassicStyle
var upload = await new UploadSkinEndpoint("access token", skin).Request();
Console.WriteLine(upload.ChangedSkin.Url);
Change skin to a network image:
var skin = new Skin("https://some/online/skin.png", Skin.SlimStyle); // or Skin.ClassicStyle
var upload = await new ChangeSkinEndpoint("access token", skin).Request();
Console.WriteLine(upload.ChangedSkin.Url);
More sample projects can be found under examples/