mirror of
https://github.com/yawaflua/spworlds-csharp-library.git
synced 2025-12-10 04:29:25 +02:00
ignores earesed
This commit is contained in:
8
.github/workflows/dotnet.yml
vendored
8
.github/workflows/dotnet.yml
vendored
@@ -23,6 +23,12 @@ jobs:
|
|||||||
- name: Restore dependencies
|
- name: Restore dependencies
|
||||||
run: dotnet restore
|
run: dotnet restore
|
||||||
- name: Build
|
- name: Build
|
||||||
run: dotnet build --no-restore
|
run: dotnet build --configuration Release --no-restore
|
||||||
- name: Test
|
- name: Test
|
||||||
run: dotnet test --no-build --verbosity normal
|
run: dotnet test --no-build --verbosity normal
|
||||||
|
- name: Publish
|
||||||
|
uses: brandedoutcast/publish-nuget@v2.5.5
|
||||||
|
with:
|
||||||
|
PROJECT_FILE_PATH: src/spworlds.csproj
|
||||||
|
NUGET_KEY: ${{secrets.NUGET_API_KEY}}
|
||||||
|
|
||||||
|
|||||||
@@ -6,32 +6,28 @@ public class User
|
|||||||
{
|
{
|
||||||
public string Name { get; }
|
public string Name { get; }
|
||||||
public string Uuid { get; }
|
public string Uuid { get; }
|
||||||
public JsonNode profile { get; }
|
|
||||||
|
|
||||||
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"];
|
||||||
profile = JsonNode.Parse(await client.GetStringAsync($"https://sessionserver.mojang.com/session/minecraft/profile/{uuid}"));
|
|
||||||
}
|
}
|
||||||
User user = new(name, uuid, profile);
|
User user = new(name, uuid);
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetSkinPart(SkinPart skinPart, string size = "64")
|
public string GetSkinPart(SkinPart skinPart, string size = "64")
|
||||||
{
|
{
|
||||||
return (string)$"https://visage.surgeplay.com/{skinPart}/{size}/{this.profile["profileId"]}";
|
return (string)$"https://visage.surgeplay.com/{skinPart}/{size}/{this.Uuid}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user