Update User.cs

This commit is contained in:
Dima YaFlay
2023-10-24 22:25:58 +03:00
committed by GitHub
parent 4b80139bee
commit 2f08e6122a

View File

@@ -9,22 +9,20 @@ public class User
public bool IsPlayer() => Name != null ? true : false;
public User(string name, string uuid, JsonNode profile)
public User(string name, string uuid)
{
Name = name;
Uuid = uuid;
this.profile = profile;
}
public static async Task<User> CreateUser(string name)
{
string uuid;
JsonNode profile;
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, profile);
User user = new(name, uuid);
return user;
}