mirror of
https://github.com/yawaflua/spworlds-csharp-library.git
synced 2025-12-10 04:29:25 +02:00
Update User.cs
This commit is contained in:
@@ -9,22 +9,20 @@ public class User
|
|||||||
|
|
||||||
public bool IsPlayer() => Name != null ? true : false;
|
public bool IsPlayer() => Name != null ? true : false;
|
||||||
|
|
||||||
public User(string name, string uuid, JsonNode profile)
|
public User(string name, string uuid)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
Uuid = uuid;
|
Uuid = uuid;
|
||||||
this.profile = profile;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<User> CreateUser(string name)
|
public static async Task<User> CreateUser(string name)
|
||||||
{
|
{
|
||||||
string uuid;
|
string uuid;
|
||||||
JsonNode profile;
|
|
||||||
using(HttpClient client = new())
|
using(HttpClient client = new())
|
||||||
{
|
{
|
||||||
uuid = (string)JsonNode.Parse(await client.GetStringAsync($"https://api.mojang.com/users/profiles/minecraft/{name}"))["id"];
|
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;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user