Skip to content

Commit 59f2597

Browse files
q-256ConnorLinfoot
andauthored
Add methods for accessing skyblock/profiles endpoint (#297)
* Added methods for getting skyblock profiles * Add new example for getting Skyblock profiles * Add new response for SkyBlock profiles * Update Java/src/main/java/net/hypixel/api/reply/skyblock/SkyBlockProfilesReply.java Co-authored-by: Connor Linfoot <[email protected]>
1 parent b20d501 commit 59f2597

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

hypixel-api-core/src/main/java/net/hypixel/api/HypixelAPI.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,28 @@ public CompletableFuture<SkyBlockProfileReply> getSkyBlockProfile(String profile
215215
);
216216
}
217217

218+
/**
219+
* @param player uuid of a player.
220+
* @return the future
221+
*/
222+
public CompletableFuture<SkyBlockProfilesReply> getSkyBlockProfiles(UUID player) {
223+
return get(SkyBlockProfilesReply.class, "skyblock/profiles",
224+
HTTPQueryParams.create()
225+
.add("uuid", player)
226+
);
227+
}
228+
229+
/**
230+
* @param player uuid of a player in string format, can be both dashed or undashed.
231+
* @return the future
232+
*/
233+
public CompletableFuture<SkyBlockProfilesReply> getSkyBlockProfiles(String player) {
234+
return get(SkyBlockProfilesReply.class, "skyblock/profiles",
235+
HTTPQueryParams.create()
236+
.add("uuid", player)
237+
);
238+
}
239+
218240
public CompletableFuture<SkyBlockNewsReply> getSkyBlockNews() {
219241
return get(SkyBlockNewsReply.class, "skyblock/news");
220242
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package net.hypixel.api.reply.skyblock;
2+
3+
import com.google.gson.JsonArray;
4+
import com.google.gson.JsonElement;
5+
import net.hypixel.api.reply.AbstractReply;
6+
7+
public class SkyBlockProfilesReply extends AbstractReply {
8+
private JsonElement profiles;
9+
10+
public JsonArray getProfiles() {
11+
if (profiles == null || profiles.isJsonNull()) {
12+
return null;
13+
} else {
14+
return profiles.getAsJsonArray();
15+
}
16+
}
17+
18+
@Override
19+
public String toString() {
20+
return "SkyBlockProfilesReply{" +
21+
"profiles=" + profiles +
22+
"} " + super.toString();
23+
}
24+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package net.hypixel.api.example.skyblock;
2+
3+
import net.hypixel.api.example.ExampleUtil;
4+
5+
public class GetSkyBlockProfilesExample {
6+
public static void main(String[] args) {
7+
ExampleUtil.API.getSkyBlockProfiles(ExampleUtil.HYPIXEL).whenComplete(ExampleUtil.getTestConsumer());
8+
ExampleUtil.await();
9+
}
10+
}

0 commit comments

Comments
 (0)