This commit is contained in:
Mih4n
2023-10-26 19:01:00 +03:00
parent 2439316b04
commit 99503e23cc
31 changed files with 1 additions and 291 deletions

33
Types/User.cs Normal file
View File

@@ -0,0 +1,33 @@
using spworlds;
using System.Text.Json.Nodes;
namespace spworlds.Types;
public class User
{
public string Name { get; }
public string Uuid { get; }
public bool IsPlayer() => Name != null ? true : false;
public User(string name, string uuid)
{
Name = name;
Uuid = uuid;
}
public static async Task<User> CreateUser(string name)
{
string uuid;
using(HttpClient client = new())
{
uuid = (string)JsonNode.Parse(await client.GetStringAsync($"https://api.mojang.com/users/profiles/minecraft/{name}"))["id"];
}
User user = new(name, uuid);
return user;
}
public string GetSkinPart(SkinPart skinPart, string size = "64")
{
return (string)$"https://visage.surgeplay.com/{skinPart}/{size}/{this.Uuid}";
}
}