@@ -37,19 +37,19 @@ public Mojang(HttpClient client)
37
37
this . client = client ;
38
38
}
39
39
40
- public Task < UserUUID > GetUUID ( string username ) =>
41
- client . SendActionAsync ( new HttpAction < UserUUID >
40
+ public Task < PlayerUUID > GetUUID ( string username ) =>
41
+ client . SendActionAsync ( new HttpAction < PlayerUUID >
42
42
{
43
43
Method = HttpMethod . Get ,
44
44
Host = "https://api.mojang.com" ,
45
45
Path = $ "users/profiles/minecraft/{ username ?? throw new ArgumentNullException ( nameof ( username ) ) } "
46
46
} ) ;
47
47
48
- public Task < UserUUID > GetUUID ( string username , DateTimeOffset timestamp ) =>
48
+ public Task < PlayerUUID > GetUUID ( string username , DateTimeOffset timestamp ) =>
49
49
GetUUID ( username , timestamp . ToUnixTimeSeconds ( ) ) ;
50
50
51
- public Task < UserUUID > GetUUID ( string username , long timestamp ) =>
52
- client . SendActionAsync ( new HttpAction < UserUUID >
51
+ public Task < PlayerUUID > GetUUID ( string username , long timestamp ) =>
52
+ client . SendActionAsync ( new HttpAction < PlayerUUID >
53
53
{
54
54
Method = HttpMethod . Get ,
55
55
Host = "https://api.mojang.com" ,
@@ -71,27 +71,27 @@ public Task<UserUUID> GetUUID(string username, long timestamp) =>
71
71
ErrorHandler = ( res , ex ) => Task . FromResult < NameHistory [ ] ? > ( null )
72
72
} ) ;
73
73
74
- public Task < UserUUID [ ] ? > GetUUIDs ( string [ ] usernames ) =>
75
- client . SendActionAsync ( new HttpAction < UserUUID [ ] ? >
74
+ public Task < PlayerUUID [ ] ? > GetUUIDs ( string [ ] usernames ) =>
75
+ client . SendActionAsync ( new HttpAction < PlayerUUID [ ] ? >
76
76
{
77
77
Method = HttpMethod . Post ,
78
78
Host = "https://api.mojang.com" ,
79
79
Path = "profiles/minecraft" ,
80
80
Content = new JsonHttpContent ( usernames ?? throw new ArgumentNullException ( ) ) ,
81
- ResponseHandler = HttpResponseHandlers . GetJsonArrayHandler < UserUUID > ( ) ,
82
- ErrorHandler = ( res , ex ) => Task . FromResult < UserUUID [ ] ? > ( null )
81
+ ResponseHandler = HttpResponseHandlers . GetJsonArrayHandler < PlayerUUID > ( ) ,
82
+ ErrorHandler = ( res , ex ) => Task . FromResult < PlayerUUID [ ] ? > ( null )
83
83
} ) ;
84
84
85
- public Task < UserProfile > GetProfileUsingUUID ( string uuid ) =>
86
- client . SendActionAsync ( new HttpAction < UserProfile >
85
+ public Task < PlayerProfile > GetProfileUsingUUID ( string uuid ) =>
86
+ client . SendActionAsync ( new HttpAction < PlayerProfile >
87
87
{
88
88
Method = HttpMethod . Get ,
89
89
Host = "https://sessionserver.mojang.com" ,
90
90
Path = $ "session/minecraft/profile/{ uuid ?? throw new ArgumentNullException ( ) } ",
91
91
ResponseHandler = uuidProfileResponseHandler
92
92
} ) ;
93
93
94
- private async Task < UserProfile > uuidProfileResponseHandler ( HttpResponseMessage response )
94
+ private async Task < PlayerProfile > uuidProfileResponseHandler ( HttpResponseMessage response )
95
95
{
96
96
string responseContent = await response . Content . ReadAsStringAsync ( ) ;
97
97
JObject job = JObject . Parse ( responseContent ) ;
@@ -128,7 +128,7 @@ private async Task<UserProfile> uuidProfileResponseHandler(HttpResponseMessage r
128
128
skin = new Skin ( null , defaultSkinType ) ;
129
129
}
130
130
131
- return new UserProfile
131
+ return new PlayerProfile
132
132
{
133
133
UUID = uuid ?? "" ,
134
134
Name = name ,
@@ -137,8 +137,8 @@ private async Task<UserProfile> uuidProfileResponseHandler(HttpResponseMessage r
137
137
} ;
138
138
}
139
139
140
- public Task < UserProfile > GetProfileUsingAccessToken ( string accessToken ) =>
141
- client . SendActionAsync ( new HttpAction < UserProfile >
140
+ public Task < PlayerProfile > GetProfileUsingAccessToken ( string accessToken ) =>
141
+ client . SendActionAsync ( new HttpAction < PlayerProfile >
142
142
{
143
143
Method = HttpMethod . Get ,
144
144
Host = "https://api.minecraftservices.com" ,
@@ -152,14 +152,14 @@ public Task<UserProfile> GetProfileUsingAccessToken(string accessToken) =>
152
152
ResponseHandler = atProfileResponseHandler
153
153
} ) ;
154
154
155
- private async Task < UserProfile > atProfileResponseHandler ( HttpResponseMessage response )
155
+ private async Task < PlayerProfile > atProfileResponseHandler ( HttpResponseMessage response )
156
156
{
157
157
string responseContent = await response . Content . ReadAsStringAsync ( ) ;
158
158
JObject job = JObject . Parse ( responseContent ) ;
159
159
160
160
var skinObj = job [ "skins" ] ? [ 0 ] ;
161
161
162
- return new UserProfile
162
+ return new PlayerProfile
163
163
{
164
164
UUID = job [ "id" ] ? . ToString ( ) ?? "" ,
165
165
Name = job [ "name" ] ? . ToString ( ) ?? "" ,
@@ -172,12 +172,12 @@ private async Task<UserProfile> atProfileResponseHandler(HttpResponseMessage res
172
172
} ;
173
173
}
174
174
175
- public Task < UserProfile > ChangeName ( string accessToken , string newName ) =>
176
- client . SendActionAsync ( new HttpAction < UserProfile >
175
+ public Task < PlayerProfile > ChangeName ( string accessToken , string newName ) =>
176
+ client . SendActionAsync ( new HttpAction < PlayerProfile >
177
177
{
178
178
Method = HttpMethod . Put ,
179
- // Host = "https://api.minecraftservices.com",
180
- Host = "http://localhost:7777" ,
179
+ Host = "https://api.minecraftservices.com" ,
180
+ // Host = "http://localhost:7777",
181
181
Path = $ "minecraft/profile/name/{ newName } ",
182
182
183
183
RequestHeaders = new HttpHeaderCollection
@@ -186,7 +186,7 @@ public Task<UserProfile> ChangeName(string accessToken, string newName) =>
186
186
} ,
187
187
188
188
ResponseHandler = atProfileResponseHandler ,
189
- ErrorHandler = HttpResponseHandlers . GetJsonErrorHandler < UserProfile > ( ) ,
189
+ ErrorHandler = HttpResponseHandlers . GetJsonErrorHandler < PlayerProfile > ( ) ,
190
190
191
191
CheckValidation = ( h ) =>
192
192
{
@@ -200,8 +200,8 @@ public Task<MojangAPIResponse> ChangeSkin(string uuid, string accessToken, SkinT
200
200
client . SendActionAsync ( new HttpAction < MojangAPIResponse >
201
201
{
202
202
Method = HttpMethod . Post ,
203
- // Host = "https://api.mojang.com",
204
- Host = "http://localhost:7777" ,
203
+ Host = "https://api.mojang.com" ,
204
+ // Host = "http://localhost:7777",
205
205
Path = $ "user/profile/{ uuid } /skin",
206
206
207
207
RequestHeaders = new HttpHeaderCollection
@@ -237,13 +237,13 @@ public Task<MojangAPIResponse> UploadSkin(string accessToken, SkinType skinType,
237
237
Stream fileStream = File . OpenRead ( skinPath ) ;
238
238
return UploadSkin ( accessToken , skinType , fileStream , filename ) ;
239
239
}
240
-
240
+
241
241
public Task < MojangAPIResponse > UploadSkin ( string accessToken , SkinType skinType , Stream skinStream , string filename ) =>
242
242
client . SendActionAsync ( new HttpAction < MojangAPIResponse >
243
243
{
244
244
Method = HttpMethod . Put ,
245
- // Host = "https://api.minecraftservices.com",
246
- Host = "http://localhost:7777" ,
245
+ Host = "https://api.minecraftservices.com" ,
246
+ // Host = "http://localhost:7777",
247
247
Path = "minecraft/profile/skins" ,
248
248
249
249
RequestHeaders = new HttpHeaderCollection
@@ -277,8 +277,8 @@ public Task<MojangAPIResponse> ResetSkin(string uuid, string accessToken) =>
277
277
client . SendActionAsync ( new HttpAction < MojangAPIResponse >
278
278
{
279
279
Method = HttpMethod . Delete ,
280
- // Host = "https://api.mojang.com",
281
- Host = "http://localhost:7777" ,
280
+ Host = "https://api.mojang.com" ,
281
+ // Host = "http://localhost:7777",
282
282
Path = $ "user/profile/{ uuid } /skin",
283
283
284
284
RequestHeaders = new HttpHeaderCollection
0 commit comments